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
Implementations on Foreign Types
impl Read for File
[src]
impl<'a> Read for &'a File
[src]
impl<R: Read> Read for BufReader<R>
[src]
impl<T> Read for Cursor<T> where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
impl<'a> Read for &'a [u8]
[src]
impl Read for Empty
[src]
impl Read for Repeat
[src]
impl Read for Stdin
[src]
impl<'a> Read for StdinLock<'a>
[src]
impl<T: Read, U: Read> Read for Chain<T, U>
[src]
impl<T: Read> Read for Take<T>
[src]
impl Read for TcpStream
[src]
impl<'a> Read for &'a TcpStream
[src]
impl Read for UnixStream
[src]
impl<'a> Read for &'a UnixStream
[src]
impl Read for ChildStdout
[src]
impl Read for ChildStderr
[src]
impl<'a, R: Read + ?Sized> Read for &'a mut R
[src]
impl<R: Read + ?Sized> Read for Box<R>
[src]
impl<R, Rs, Ms> Read for BufReader<R, Rs, Ms> where
R: Read,
Rs: ReadStrategy,
Ms: MoveStrategy,
[src]
R: Read,
Rs: ReadStrategy,
Ms: MoveStrategy,
Implementors
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>