1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use crate::blockchain::block::Block;
use serde_json::{self, Error};
use std::{collections::BTreeMap, io::Read};
#[derive(Debug, PartialEq, Deserialize)]
pub struct BlockEnDeTest(BTreeMap<String, Block>);
impl IntoIterator for BlockEnDeTest {
type Item = <BTreeMap<String, Block> as IntoIterator>::Item;
type IntoIter = <BTreeMap<String, Block> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl BlockEnDeTest {
pub fn load<R>(reader: R) -> Result<Self, Error>
where
R: Read,
{
serde_json::from_reader(reader)
}
}