Input

Trait Input 

Source
pub trait Input {
    // Required methods
    fn tag(&self) -> &'static str;
    fn try_deserialize(
        &self,
        serialized: &Value,
        checker: &mut Checker,
    ) -> Result<Any>;
    fn example(&self) -> Result<Value>;
}

Required Methods§

Source

fn tag(&self) -> &'static str

Return the discriminant associated with this type.

This is used to map inputs types to their respective parsers.

Well formed implementations should always return the same result.

Source

fn try_deserialize( &self, serialized: &Value, checker: &mut Checker, ) -> Result<Any>

Attempt to deserialize an opaque object from the raw serialized representation.

Deserialized values can be constructed and returned via Checker::any.

Source

fn example(&self) -> Result<Value>

Print an example JSON representation of objects this input is expected to parse.

Well formed implementations should passing the returned serde_json::Value back to Self::try_deserialize correctly deserializes, though it need not necessarily pass CheckDeserialization.

Implementors§