Struct tokio::io::Take

source · []
pub struct Take<R> { /* private fields */ }
Expand description

Stream for the take method.

Implementations

Returns the remaining number of bytes that can be read before this instance will return EOF.

Note

This instance may reach EOF after reading fewer bytes than indicated by this method if the underlying AsyncRead instance reaches EOF.

Sets the number of bytes that can be read before this instance will return EOF. This is the same as constructing a new Take instance, so the amount of bytes read and the previous limit value don’t matter when calling this method.

Gets a reference to the underlying reader.

Gets a mutable reference to the underlying reader.

Care should be taken to avoid modifying the internal I/O state of the underlying reader as doing so may corrupt the internal limit of this Take.

Gets a pinned mutable reference to the underlying reader.

Care should be taken to avoid modifying the internal I/O state of the underlying reader as doing so may corrupt the internal limit of this Take.

Consumes the Take, returning the wrapped reader.

Trait Implementations

Attempts to return the contents of the internal buffer, filling it with more data from the inner reader if it is empty. Read more

Tells this buffer that amt bytes have been consumed from the buffer, so they should no longer be returned in calls to poll_read. Read more

Attempts to read from the AsyncRead into buf. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.