Trait ezio::Read

source ·
pub trait Read: IntoIterator + Read {
    // Required methods
    fn read_all(&mut self) -> String;
    fn read_line(&mut self) -> String;

    // Provided method
    fn read_line_any<T: FromStr>(&mut self) -> T
       where Self: Sized { ... }
}
Expand description

A trait for objects which can read data.

Can be turned into an iterator to read all available lines as strings.

Required Methods§

source

fn read_all(&mut self) -> String

Read and return all available data from self.

Panics if there is an error reading.

source

fn read_line(&mut self) -> String

Read and return a single line of data from self.

Panics if there is an error reading. Note that for finite data sources (e.g., files) this function will panic when the reader is exhausted. To get all lines (if the number of lines is not known in advance), convert the reader into an iterator instead.

Does not return the terminal newline character.

Provided Methods§

source

fn read_line_any<T: FromStr>(&mut self) -> T
where Self: Sized,

Read, parse, and return a single line of data from self.

Panics if there is an error reading or parsing data.

Implementors§

source§

impl Read for ezio::file::Reader

source§

impl Read for Stdin

source§

impl<'a> Read for ezio::string::Reader<'a>