Struct async_bincode::futures::AsyncBincodeReader
source · pub struct AsyncBincodeReader<R, T>(/* private fields */);
Expand description
A wrapper around an asynchronous reader that produces an asynchronous stream of bincode-decoded values.
To use, provide a reader that implements
futures_io::AsyncRead
,
and then use futures_core::Stream
to access the deserialized values.
Note that the sender must prefix each serialized item with its size as reported by
bincode::serialized_size
encoded as a four-byte network-endian encoded. Use the
marker trait AsyncDestination
to add it automatically when using
AsyncBincodeWriter
.
Implementations§
source§impl<R, T> AsyncBincodeReader<R, T>
impl<R, T> AsyncBincodeReader<R, T>
sourcepub fn get_ref(&self) -> &R
pub fn get_ref(&self) -> &R
Gets a reference to the underlying reader.
It is inadvisable to directly read from the underlying reader.
sourcepub fn get_mut(&mut self) -> &mut R
pub fn get_mut(&mut self) -> &mut R
Gets a mutable reference to the underlying reader.
It is inadvisable to directly read from the underlying reader.
sourcepub fn buffer(&self) -> &[u8] ⓘ
pub fn buffer(&self) -> &[u8] ⓘ
Returns a reference to the internally buffered data.
This will not attempt to fill the buffer if it is empty.
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Unwraps this AsyncBincodeReader
, returning the underlying reader.
Note that any leftover data in the internal buffer is lost.