Struct async_bincode::futures::AsyncBincodeReader
source · [−]pub struct AsyncBincodeReader<R, T>(_);
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. See also
[serialize_into
], which does this for you.
Implementations
sourceimpl<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]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
pub fn buffer(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [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.
Trait Implementations
sourceimpl<R: Debug, T: Debug> Debug for AsyncBincodeReader<R, T>
impl<R: Debug, T: Debug> Debug for AsyncBincodeReader<R, T>
sourceimpl<R, T> Default for AsyncBincodeReader<R, T> where
R: Default,
impl<R, T> Default for AsyncBincodeReader<R, T> where
R: Default,
sourceimpl<R, T> From<R> for AsyncBincodeReader<R, T>
impl<R, T> From<R> for AsyncBincodeReader<R, T>
sourceimpl<R, T> Stream for AsyncBincodeReader<R, T> where
for<'a> T: Deserialize<'a>,
R: AsyncRead + Unpin,
impl<R, T> Stream for AsyncBincodeReader<R, T> where
for<'a> T: Deserialize<'a>,
R: AsyncRead + Unpin,
impl<R, T> Unpin for AsyncBincodeReader<R, T> where
R: Unpin,
Auto Trait Implementations
impl<R, T> RefUnwindSafe for AsyncBincodeReader<R, T> where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<R, T> Send for AsyncBincodeReader<R, T> where
R: Send,
T: Send,
impl<R, T> Sync for AsyncBincodeReader<R, T> where
R: Sync,
T: Sync,
impl<R, T> UnwindSafe for AsyncBincodeReader<R, T> where
R: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more