Skip to main content

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, Any::new or Any::raw.

If using the Any constructors directly, implementations should associate Self::tag with the returned Any. If Checker::any is used - this will happen automatically.

Implementations are strongly encouraged to implement CheckDeserialization and use this API to ensure shared resources (like input files or output files) are correctly resolved and properly shared among all jobs in a benchmark run.

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§