[−][src]Struct tokio_serde_bincode::WriteBincode
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][−]
T: Sink<SinkItem = Bytes>,
T::SinkError: From<Error>,
U: Serialize,
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][+]
T: Sink<SinkItem = Bytes>,
T::SinkError: From<Error>,
U: Serialize,
impl<T, U> Stream for WriteBincode<T, U> where
T: Stream + Sink,
[src][+]
T: Stream + Sink,
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,
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,
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,
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,
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,
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][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,