Skip to main content

FlattenMap

Trait FlattenMap 

Source
pub trait FlattenMap<T>: Map {
    // Required methods
    fn accepts_key(&self, k: &str) -> bool;
    fn build(&mut self) -> Result<T>;
}
Expand description

A de::Map that produces a typed T directly after being driven.

Each struct that derives midiserde::Deserialize automatically implements this trait, enabling it to be used as a #[mini(flatten)] field in a parent.

accepts_key lets the parent route JSON keys at parse time instead of buffering them for later replay.

Required Methods§

Source

fn accepts_key(&self, k: &str) -> bool

Returns true if this map handles the given JSON key.

Source

fn build(&mut self) -> Result<T>

Produce the deserialized value. Call after finish().

Implementors§