[][src]Struct tokio_serde::FramedWrite

pub struct FramedWrite<T, U, S> { /* fields omitted */ }

Adapts a buffer sink to a value sink by serializing the values.

The provided buffer sink will received buffer values containing the serialized value. Each buffer contains exactly one value. This sink will be responsible for writing these buffers to an AsyncWrite using some sort of framing strategy. 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> FramedWrite<T, U, S>[src]

pub fn new(inner: T, serializer: S) -> Self[src]

Creates a new FramedWrite with the given buffer sink and serializer.

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

Returns a reference to the underlying sink wrapped by FramedWrite.

Note that care should be taken to not tamper with the underlying sink as it may corrupt the sequence of frames otherwise being worked with.

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

Returns a mutable reference to the underlying sink wrapped by FramedWrite.

Note that care should be taken to not tamper with the underlying sink as it may corrupt the sequence of frames otherwise being worked with.

pub fn into_inner(self) -> T[src]

Consumes the FramedWrite, returning its underlying sink.

Note that care should be taken to not tamper with the underlying sink as it may corrupt the sequence of frames otherwise being worked with.

Trait Implementations

impl<'pin, T, U, S> Unpin for FramedWrite<T, U, S> where
    __FramedWrite<'pin, T, U, S>: Unpin
[src]

impl<T, U, S> Sink<U> for FramedWrite<T, U, S> where
    T: Sink<Bytes>,
    S: Serializer<U>,
    S::Error: Into<T::Error>, 
[src]

type Error = T::Error

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

impl<T, U, S> Stream for FramedWrite<T, U, S> where
    T: Stream
[src]

type Item = T::Item

Values yielded by the stream.

Auto Trait Implementations

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

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

impl<T, U, S> UnwindSafe for FramedWrite<T, U, S> where
    S: UnwindSafe,
    T: UnwindSafe,
    U: UnwindSafe

impl<T, U, S> RefUnwindSafe for FramedWrite<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]