[][src]Struct tokio_serde_bincode::WriteBincode

pub struct WriteBincode<T: Sink, U> { /* fields omitted */ }
[]

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

WriteBincode implements Sink by serializing the submitted values to a buffer. The buffer is then sent to the inner stream, which is responsible for handling framing on the wire.

Implementations

impl<T, U> WriteBincode<T, U> where
    T: Sink<SinkItem = Bytes>,
    T::SinkError: From<Error>,
    U: Serialize
[src][]

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

Creates a new WriteBincode with the given buffer sink.

impl<T: Sink, U> WriteBincode<T, U>[src][]

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

Returns a reference to the underlying sink wrapped by WriteBincode.

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

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 WriteBincode, 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<T, U> Sink for WriteBincode<T, U> where
    T: Sink<SinkItem = Bytes>,
    T::SinkError: From<Error>,
    U: Serialize
[src][+]

type SinkItem = U

The type of value that the sink accepts.

type SinkError = <T as Sink>::SinkError

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

impl<T, U> Stream for WriteBincode<T, U> where
    T: Stream + Sink
[src][+]

type Item = T::Item

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> RefUnwindSafe for WriteBincode<T, U> where
    T: RefUnwindSafe,
    U: RefUnwindSafe,
    <T as Sink>::SinkError: RefUnwindSafe,
    <T as Sink>::SinkItem: RefUnwindSafe

impl<T, U> Send for WriteBincode<T, U> where
    T: Send,
    U: Send,
    <T as Sink>::SinkError: Send,
    <T as Sink>::SinkItem: Send

impl<T, U> Sync for WriteBincode<T, U> where
    T: Sync,
    U: Sync,
    <T as Sink>::SinkError: Sync,
    <T as Sink>::SinkItem: Sync

impl<T, U> Unpin for WriteBincode<T, U> where
    T: Unpin,
    U: Unpin,
    <T as Sink>::SinkError: Unpin,
    <T as Sink>::SinkItem: Unpin

impl<T, U> UnwindSafe for WriteBincode<T, U> where
    T: UnwindSafe,
    U: UnwindSafe,
    <T as Sink>::SinkError: UnwindSafe,
    <T as Sink>::SinkItem: 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.