Struct std::io::TakeAdapter
struct TakeAdapter<R> { ... }
R: Readable<R>
Adapter for a stream that returns EOF after limit
bytes are read.
See take extension method.
Fields
-
limit: u64
-
inner: &mut R
Methods
impl TakeAdapter<R> { ... }
R: Readable<R>
-
fn new(inner: &mut R, limit: u64) -> TakeAdapter<R>
Creates a new adapter for the given stream.
-
fn read(self: &mut TakeAdapter<R>, buf: &mut [u8]) -> Result<usize>
Reads from the stream into a provided buffer.
If successful, returns the number of bytes read. This may be less than the size of the provided buffer.
Mixins
impl TakeAdapter<R> { ... }
R: Readable<R>
-
mixin Readable<TakeAdapter<R>>
-
Fills the provided buffer by reading from the stream.
If stream had less bytes available than the size of the buffer, this method will return an
Error::eof()
. -
Reads the entire stream into a
StringBuf
.If successful, returns the number of bytes that were read.