Trait netio::Read
[−]
[src]
pub trait Read: Stream { fn read(&mut self, buf: &mut [u8]) -> Result<usize>; fn chain<R>(self, next: R) -> Chain<Self, R>
where
Self: Sized,
R: Read, { ... } 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 place, because they cannot be implemented with providing all desired guarantees:
read_to_end
→BufRead::read_to_end
read_to_string
→Utf8Reader::read_to_string
read_exact
→BufRead::read_exact
bytes
→BufRead::bytes
chars
→Utf8Reader::chars
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
.
Provided Methods
fn chain<R>(self, next: R) -> Chain<Self, R> where
Self: Sized,
R: Read,
Self: Sized,
R: Read,
Creates an adaptor which will chain this stream with another.
This method is equivalent to std::io::Read::chain
.
fn buffer(self) -> BufReader<Self> where
Self: Sized,
Self: Sized,
Creates a buffered reader with default capacity and default strategies
Please see the documentation of BufReader
for more details
fn repeat(self) -> Repeat<Self> where
Self: Sized,
Self: Sized,
Transforms this reader into a reader that automatically restarts from the beginning after EOF is reached
Implementors
impl Read for File
impl<'a> Read for &'a File
impl<R: Read> Read for std::io::buffered::BufReader<R>
impl<T> Read for Cursor<T> where
T: AsRef<[u8]>,impl<'a> Read for &'a [u8]
impl Read for Empty
impl Read for std::io::util::Repeat
impl Read for Stdin
impl<'a> Read for StdinLock<'a>
impl<T: Read, U: Read> Read for std::io::Chain<T, U>
impl<T: Read> Read for std::io::Take<T>
impl Read for TcpStream
impl<'a> Read for &'a TcpStream
impl Read for UnixStream
impl<'a> Read for &'a UnixStream
impl Read for ChildStdout
impl Read for ChildStderr
impl<'a, R: Read + ?Sized> Read for &'a mut R
impl<R: Read + ?Sized> Read for Box<R>
impl<R, Rs, Ms> Read for buf_redux::BufReader<R, Rs, Ms> where
R: Read,
Rs: ReadStrategy,
Ms: MoveStrategy,impl<I: Read> Read for Retry<I>
impl<I: Read + Seek> Read for netio::Repeat<I>
impl<T: Read> Read for netio::Take<T>
impl<T: Read, U: Read> Read for netio::Chain<T, U>
impl<R: Read> Read for Compat<R>
impl<R: Read> Read for Collect<R>
impl<T: Read> Read for Limited<T>
impl<R: Read> Read for Throttled<R>