pub trait Read: Stream {
// Required method
fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
// Provided methods
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 { ... }
}
Expand description
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§
Provided Methods§
Sourcefn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
fn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
Creates an adaptor which will chain this stream with another.
This method is equivalent to std::io::Read::chain
.