Skip to main content

Sample

Trait Sample 

Source
pub trait Sample: Sized {
    // Required method
    fn sample_full() -> Self;

    // Provided methods
    fn sample_minimal() -> Self { ... }
    fn sample_alternates() -> Vec<Self> { ... }
}
Expand description

A canonical value of one type, for the schema set and the round-trip corpus.

Required Methods§

Source

fn sample_full() -> Self

A value carrying every field the type declares.

Provided Methods§

Source

fn sample_minimal() -> Self

A value carrying every optional field absent.

Source

fn sample_alternates() -> Vec<Self>

One value per further arm, for a type whose wire form is a union.

A union’s arms declare fields the other arms do not, so a corpus of one value per type would leave those fields undriven. Every arm a type declares beyond the one sample_full carries belongs here.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§