[][src]Struct tokio_serde::FramedRead

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

Adapts a stream of buffers to a stream of values by deserializing them.

It is expected that the buffers yielded by the supplied stream be framed. In other words, each yielded buffer must represent exactly one serialized value. The specific framing strategy is left up to the implementor. One option would be to use length_delimited provided by tokio-io.

Implementations

impl<T, U, S> FramedRead<T, U, S> where
    T: Stream,
    BytesMut: From<T::Item>,
    S: Deserializer<U>,
    S::Error: Into<T::Error>, 
[src][]

pub fn new(inner: T, deserializer: S) -> FramedRead<T, U, S>[src][]

Creates a new FramedRead with the given buffer stream and deserializer.

impl<T, U, S> FramedRead<T, U, S>[src][]

pub fn get_ref(&self) -> &T[src][]

Returns a reference to the underlying stream wrapped by FramedRead.

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 FramedRead.

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 FramedRead, 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, S> Stream for FramedRead<T, U, S> where
    T: Stream,
    T::Error: From<S::Error>,
    BytesMut: From<T::Item>,
    S: Deserializer<U>, 
[src][+]

type Item = U

The type of item this stream will yield on success.

type Error = T::Error

The type of error this stream may generate.

Auto Trait Implementations

impl<T, U, S> RefUnwindSafe for FramedRead<T, U, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe,
    U: RefUnwindSafe

impl<T, U, S> Send for FramedRead<T, U, S> where
    S: Send,
    T: Send,
    U: Send

impl<T, U, S> Sync for FramedRead<T, U, S> where
    S: Sync,
    T: Sync,
    U: Sync

impl<T, U, S> Unpin for FramedRead<T, U, S> where
    S: Unpin,
    T: Unpin,
    U: Unpin

impl<T, U, S> UnwindSafe for FramedRead<T, U, S> where
    S: UnwindSafe,
    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.