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

Methods

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

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

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

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<'pin, T, U, S> Unpin for FramedRead<T, U, S> where
    __FramedRead<'pin, T, U, S>: Unpin
[src]

impl<T, U, S, SinkItem> Sink<SinkItem> for FramedRead<T, U, S> where
    T: Sink<SinkItem>, 
[src]

type Error = T::Error

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

impl<T, U, S> Stream for FramedRead<T, U, S> where
    T: TryStream<Ok = BytesMut>,
    T::Error: From<S::Error>,
    BytesMut: From<T::Ok>,
    S: Deserializer<U>, 
[src]

type Item = Result<U, T::Error>

Values yielded by the stream.

Auto Trait Implementations

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

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

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

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

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized
[src]

impl<T, Item> SinkExt<Item> for T where
    T: Sink<Item> + ?Sized
[src]