[−][src]Struct tokio_serde_bincode::ReadBincode
Adapts a stream of Bincode encoded buffers to a stream of values by deserializing them.
ReadBincode
implements Stream
by polling the inner buffer stream and
deserializing the buffer as Bincode. It expects that each yielded buffer
represents a single Bincode value and does not contain any extra trailing
bytes.
Implementations
impl<T, U> ReadBincode<T, U> where
T: Stream,
T::Error: From<Error>,
U: for<'de> Deserialize<'de>,
BytesMut: From<T::Item>,
[src][−]
T: Stream,
T::Error: From<Error>,
U: for<'de> Deserialize<'de>,
BytesMut: From<T::Item>,
pub fn new(inner: T) -> ReadBincode<T, U>
[src][−]
Creates a new ReadBincode
with the given buffer stream.
impl<T, U> ReadBincode<T, U>
[src][−]
pub fn get_ref(&self) -> &T
[src][−]
Returns a reference to the underlying stream wrapped by ReadBincode
.
Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.
pub fn get_mut(&mut self) -> &mut T
[src][−]
Returns a mutable reference to the underlying stream wrapped by
ReadBincode
.
Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.
pub fn into_inner(self) -> T
[src][−]
Consumes the ReadBincode
, returning its underlying stream.
Note that care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.
Trait Implementations
impl<T, U> Sink for ReadBincode<T, U> where
T: Sink,
[src][+]
T: Sink,
impl<T, U> Stream for ReadBincode<T, U> where
T: Stream,
T::Error: From<Error>,
U: for<'de> Deserialize<'de>,
BytesMut: From<T::Item>,
[src][+]
T: Stream,
T::Error: From<Error>,
U: for<'de> Deserialize<'de>,
BytesMut: From<T::Item>,
Auto Trait Implementations
impl<T, U> RefUnwindSafe for ReadBincode<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for ReadBincode<T, U> where
T: Send,
U: Send,
T: Send,
U: Send,
impl<T, U> Sync for ReadBincode<T, U> where
T: Sync,
U: Sync,
T: Sync,
U: Sync,
impl<T, U> Unpin for ReadBincode<T, U> where
T: Unpin,
U: Unpin,
T: Unpin,
U: Unpin,
impl<T, U> UnwindSafe for ReadBincode<T, U> where
T: UnwindSafe,
U: UnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,