TestInput

Trait TestInput 

Source
pub trait TestInput: Sized {
    type Err: Error;

    // Required method
    fn try_read_from(data: &[u8]) -> Result<Self, Self::Err>;

    // Provided method
    fn read_from(data: &[u8]) -> Self { ... }
}

Required Associated Types§

Required Methods§

Source

fn try_read_from(data: &[u8]) -> Result<Self, Self::Err>

Provided Methods§

Source

fn read_from(data: &[u8]) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TestInput for String

Source§

type Err = Utf8Error

Source§

fn try_read_from(data: &[u8]) -> Result<Self, Self::Err>

Source§

impl TestInput for Vec<u8>

Source§

type Err = Infallible

Source§

fn try_read_from(data: &[u8]) -> Result<Self, Self::Err>

Source§

impl<T> TestInput for Box<T>
where T: TestInput,

Source§

type Err = <T as TestInput>::Err

Source§

fn try_read_from(data: &[u8]) -> Result<Self, Self::Err>

Implementors§