[][src]Struct tokio_serde_bincode::ReadBincode

pub struct ReadBincode<T, U> { /* fields omitted */ }
[]

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][]

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][+]

type SinkItem = T::SinkItem

The type of value that the sink accepts.

type SinkError = T::SinkError

The type of value produced by the sink when an error occurs.

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][+]

type Item = U

The type of item this stream will yield on success.

type Error = <T as Stream>::Error

The type of error this stream may generate.

Auto Trait Implementations

impl<T, U> RefUnwindSafe for ReadBincode<T, U> where
    T: RefUnwindSafe,
    U: RefUnwindSafe

impl<T, U> Send for ReadBincode<T, U> where
    T: Send,
    U: Send

impl<T, U> Sync for ReadBincode<T, U> where
    T: Sync,
    U: Sync

impl<T, U> Unpin for ReadBincode<T, U> where
    T: Unpin,
    U: Unpin

impl<T, U> UnwindSafe for ReadBincode<T, U> where
    T: UnwindSafe,
    U: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<T> From<T> for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.