ReadInto

Trait ReadInto 

Source
pub trait ReadInto<T>: BufReadExt {
    type Error: Error;

    // Required methods
    fn try_read(&mut self) -> Result<T, Self::Error>;
    fn try_read_n(&mut self, n: usize) -> Result<Vec<T>, Self::Error>;
    fn try_read_m_n(
        &mut self,
        m: usize,
        n: usize,
    ) -> Result<Mat<T>, Self::Error>;

    // Provided methods
    fn read(&mut self) -> T { ... }
    fn read_n(&mut self, n: usize) -> Vec<T> { ... }
    fn read_m_n(&mut self, m: usize, n: usize) -> Mat<T> { ... }
}
Expand description

The opposite of ReadFrom.

Required Associated Types§

Source

type Error: Error

Errors that come from ReadOneFrom.

This is usually ReadError.

Required Methods§

Source

fn try_read(&mut self) -> Result<T, Self::Error>

Read from self and parse into Self.

Source

fn try_read_n(&mut self, n: usize) -> Result<Vec<T>, Self::Error>

Read n elements from self, parse into Self and aggregate them into a single Vec.

Source

fn try_read_m_n(&mut self, m: usize, n: usize) -> Result<Mat<T>, Self::Error>

Read m * n elements from self, parse into Self and aggregate them into a single Mat.

Provided Methods§

Source

fn read(&mut self) -> T

Unwrap the result of ReadInto::try_read.

Source

fn read_n(&mut self, n: usize) -> Vec<T>

Unwrap the result of ReadInto::try_read_n.

Source

fn read_m_n(&mut self, m: usize, n: usize) -> Mat<T>

Unwrap the result of ReadInto::try_read_m_n.

Implementors§

Source§

impl<T: BufReadExt, U> ReadInto<U> for T
where U: ReadFrom,