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:
read_to_end
-> moved toBufRead
read_to_string
-> moved toBufReadGrow
read_exact
-> moved toBufRead
bytes
-> moved toBufRead
chars
-> moved toBufReadGrow
Required Methods
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
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
.
fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized
Creates an adaptor which will chain this stream with another.
This method is equivalent to std::io::Read::chain
.
Provided Methods
fn buffer(self) -> BufReader<Self> 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 repeat(self) -> Repeat<Self> where Self: Sized
Transforms this reader into a reader that automatically restarts from the beginning after EOF is reached