Trait Parse

Source
pub trait Parse: Sized {
    type Error;

    // Required method
    fn parse(input: &mut impl Read) -> Result<Self, Self::Error>;

    // Provided method
    fn parse_multi<T>(
        input: &mut impl Read,
        count: usize,
    ) -> Result<T, Self::Error>
       where T: FromIterator<Self> { ... }
}
Expand description

Interface for parsing a value from a Read input.

Required Associated Types§

Source

type Error

Associated error which can happen during parsing.

Required Methods§

Source

fn parse(input: &mut impl Read) -> Result<Self, Self::Error>

Parses a value of this type from the input.

Provided Methods§

Source

fn parse_multi<T>(input: &mut impl Read, count: usize) -> Result<T, Self::Error>
where T: FromIterator<Self>,

Parses multiple values of this type from the input into a Vec.

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.

Implementors§