-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
42 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
group_imports = "StdExternalCrate" | ||
imports_granularity = "Preserve" | ||
reorder_imports = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub mod register_continuous_memorypage; | ||
pub mod register_continuous_memory_page; | ||
pub mod register_continuous_page_batch; | ||
pub mod sample_register_memory; | ||
pub mod types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 12 additions & 23 deletions
35
src/contracts_caller/memory_page_fact_registry/sample_register_memory.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
use std::fs::File; | ||
use std::io::BufReader; | ||
|
||
use crate::contracts_caller::memory_page_fact_registry::types::register_continuous_memorypage::ContinuousMemorypage; | ||
use crate::contracts_caller::memory_page_fact_registry::types::register_continuous_memory_page::ContinuousMemoryPage; | ||
use crate::contracts_caller::memory_page_fact_registry::types::register_continuous_page_batch::MemoryPageEntries; | ||
|
||
pub fn sample_register_continuous_page_batch() -> anyhow::Result<MemoryPageEntries> { | ||
let file_path = | ||
"src/data_samples/memory_page_fact_registry/register_continuous_page_batch.json" | ||
.to_string(); | ||
let input_file = File::open(file_path)?; | ||
let reader = BufReader::new(input_file); | ||
let memory_page_entries: MemoryPageEntries = serde_json::from_reader(reader)?; | ||
let byte = include_bytes!( | ||
"../../data_samples/memory_page_fact_registry/register_continuous_page_batch.json" | ||
); | ||
let memory_page_entries: MemoryPageEntries = serde_json::from_slice(byte)?; | ||
Ok(memory_page_entries) | ||
} | ||
|
||
pub fn sample_register_continuous_page() -> anyhow::Result<ContinuousMemorypage> { | ||
let file_path = | ||
"src/data_samples/memory_page_fact_registry/register_memory_page.json".to_string(); | ||
let input_file = File::open(file_path)?; | ||
let reader = BufReader::new(input_file); | ||
let continuous_memmory_page: ContinuousMemorypage = serde_json::from_reader(reader)?; | ||
Ok(continuous_memmory_page) | ||
pub fn sample_register_continuous_page() -> anyhow::Result<ContinuousMemoryPage> { | ||
let byte = | ||
include_bytes!("../../data_samples/memory_page_fact_registry/register_memory_page.json"); | ||
let continuous_memory_page: ContinuousMemoryPage = serde_json::from_slice(byte)?; | ||
Ok(continuous_memory_page) | ||
} | ||
|
||
pub fn sample_large_data_register_continuous_page_batch() -> anyhow::Result<MemoryPageEntries> { | ||
let file_path = | ||
"src/data_samples/memory_page_fact_registry/large_data_register_continuous_page_batch.json" | ||
.to_string(); | ||
let input_file = File::open(file_path)?; | ||
let reader = BufReader::new(input_file); | ||
let memory_page_entries: MemoryPageEntries = serde_json::from_reader(reader)?; | ||
let byte = include_bytes!("../../data_samples/memory_page_fact_registry/large_data_register_continuous_page_batch.json"); | ||
let memory_page_entries: MemoryPageEntries = serde_json::from_slice(byte)?; | ||
Ok(memory_page_entries) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pub mod register_continuous_memorypage; | ||
pub mod register_continuous_memory_page; | ||
pub mod register_continuous_page_batch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/contracts_caller/memory_page_fact_registry/types/register_continuous_page_batch.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
use crate::contracts_caller::memory_page_fact_registry::types::register_continuous_memorypage::ContinuousMemorypage; | ||
use serde::Deserialize; | ||
|
||
use crate::contracts_caller::memory_page_fact_registry::types::register_continuous_memory_page::ContinuousMemoryPage; | ||
|
||
#[derive(Deserialize, Debug)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct MemoryPageEntries { | ||
pub memory_page_entries: Vec<ContinuousMemorypage>, | ||
pub memory_page_entries: Vec<ContinuousMemoryPage>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters