Trait netio::Read [] [src]

pub trait Read: Stream {
    fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
    fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized;

    fn buffer(self) -> BufReader<Self> where Self: Sized { ... }
    fn repeat(self) -> Repeat<Self> where Self: Sized { ... }
}

Alternative to std::io::Read

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

Diffrerences to std::io::Read

Methods that are just wrappers around the equivalent methods of std::io::Read:

  • read
  • chain

New methods that have no counterpart in std::io::Read:

  • buffer
  • repeat

Functions that were removed or moved to a different trait, because they cannot be implemented with providing all desired guarantees:

Required Methods

Pull some bytes from this source into the specified buffer, returning how many bytes were read.

This methode is equivalent to std::io::Read::read.

Creates an adaptor which will chain this stream with another.

This method is equivalent to std::io::Read::chain.

Provided Methods

Creates a buffered reader with default capacity and default strategies

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

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

Implementors