use std::collections::BTreeMap; use serde::Deserialize; use serde::de::DeserializeOwned; /// A genric wrapper over a `BTreeMap` for tests #[derive(Deserialize)] pub struct GenericTester(BTreeMap); impl IntoIterator for GenericTester { type Item = as IntoIterator>::Item; type IntoIter = as IntoIterator>::IntoIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } impl GenericTester where T: DeserializeOwned + Ord, U: DeserializeOwned { /// Loads test from json. pub fn load(reader: R) -> Result where R: std::io::Read { serde_json::from_reader(reader) } }