Trait netio::ReadExt [] [src]

pub trait ReadExt: Read {
    fn buffer(self) -> BufReader<Self, DefaultReadStrategy, DefaultMoveStrategy> where Self: Sized { ... }
    fn retry(self) -> Retry<Self> where Self: Sized { ... }
    fn repeat(self) -> Repeat<Self> where Self: Sized { ... }
    fn take_net(self, limit: u64) -> Take<Self> where Self: Sized { ... }
}

Extension methods for std::io::Read

This trait is automatically implemented for all types that implement std::io::Read.

Provided Methods

fn buffer(self) -> BufReader<Self, DefaultReadStrategy, DefaultMoveStrategy> where Self: Sized

Creates a buffered reader with default capacity and default strategies

Please see the documentation of buf_redux::BufReader for more details

fn retry(self) -> Retry<Self> where Self: Sized

Transforms this reader into a reader that automatically retries on interrupts

The returned adapter will behave identically to the original reader, except that it retries the reading operation automatically if an error of kind ErrorKind::Interrupted occurs.

Note

Methods that are already expected to retry are forwarded directly to the underlying reader.

fn repeat(self) -> Repeat<Self> where Self: Sized

Transforms this reader into a reader that automatically restarts from the beginning after EOF is reached

fn take_net(self, limit: u64) -> Take<Self> where Self: Sized

Creates an adapter which will read at most limit bytes from it.

This function returns a new instance of Read which will read at most limit bytes, after which it will always return EOF (Ok(0)). Any read errors will not count towards the number of bytes read and future calls to read may succeed.

This function is equivalent to std::io::Read::take but the returened adapter implements BufReadGrow if possible.

Implementors