Skip to main content

Input

Trait Input 

Source
pub trait Input:
    Sized
    + Debug
    + 'static {
    type Raw: DeserializeOwned + Serialize;

    // Required methods
    fn tag() -> &'static str;
    fn from_raw(raw: Self::Raw, checker: &mut Checker) -> Result<Self>;
    fn serialize(&self) -> Result<Value>;
    fn example() -> Self::Raw;
}
Expand description

Inputs to Benchmarks.

These begin as raw data transfer objects before final construction via from_raw.

Required Associated Types§

Source

type Raw: DeserializeOwned + Serialize

The raw form of this input that is deserialized from input files and serialized as examples. The raw nature of this type reflects that no input validation has been performed beyond the checks performed by its Deserialize implementation.

Final object validation is performed via from_raw.

Required Methods§

Source

fn tag() -> &'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 from_raw(raw: Self::Raw, checker: &mut Checker) -> Result<Self>

Construct Self from the raw deserialized representation, performing any necessary validation checks (e.g., resolving file paths via the Checker).

Source

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

Serialize self to a serde_json::Value.

Source

fn example() -> Self::Raw

Return an example of a raw input for this Input.

This is used to supply sample JSON layouts in the benchmark CLI.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§