pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>where
T: DeserializeOwned + 'static,
D: Deserializer<'de>,Expand description
Deserialize a value from recursive singleton map format.
This is the counterpart to serialize, deserializing from the
singleton map format back to the original type.
ยงExamples
use noyalib::with::singleton_map_recursive;
#[derive(serde::Deserialize, serde::Serialize, PartialEq, Debug)]
enum Inner { A }
#[derive(serde::Deserialize, Debug)]
struct Doc {
#[serde(with = "singleton_map_recursive")]
items: Vec<Inner>,
}
let d: Doc = noyalib::from_str("items:\n - A: null\n").unwrap();
assert_eq!(d.items.len(), 1);