[−][src]Struct tokio_serde::FramedWrite
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.
Implementations
impl<T, U, S> FramedWrite<T, U, S> where
T: Sink<SinkItem = Bytes>,
S: Serializer<U>,
S::Error: Into<T::SinkError>,
[src][−]
T: Sink<SinkItem = Bytes>,
S: Serializer<U>,
S::Error: Into<T::SinkError>,
pub fn new(inner: T, serializer: S) -> Self
[src][−]
Creates a new FramedWrite
with the given buffer sink and serializer.
impl<T: Sink, U, S> FramedWrite<T, U, S>
[src][−]
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<T, U, S> Sink for FramedWrite<T, U, S> where
T: Sink<SinkItem = Bytes>,
S: Serializer<U>,
S::Error: Into<T::SinkError>,
[src][+]
T: Sink<SinkItem = Bytes>,
S: Serializer<U>,
S::Error: Into<T::SinkError>,
Auto Trait Implementations
impl<T, U, S> RefUnwindSafe for FramedWrite<T, U, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
<T as Sink>::SinkError: RefUnwindSafe,
<T as Sink>::SinkItem: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
<T as Sink>::SinkError: RefUnwindSafe,
<T as Sink>::SinkItem: RefUnwindSafe,
impl<T, U, S> Send for FramedWrite<T, U, S> where
S: Send,
T: Send,
U: Send,
<T as Sink>::SinkError: Send,
<T as Sink>::SinkItem: Send,
S: Send,
T: Send,
U: Send,
<T as Sink>::SinkError: Send,
<T as Sink>::SinkItem: Send,
impl<T, U, S> Sync for FramedWrite<T, U, S> where
S: Sync,
T: Sync,
U: Sync,
<T as Sink>::SinkError: Sync,
<T as Sink>::SinkItem: Sync,
S: Sync,
T: Sync,
U: Sync,
<T as Sink>::SinkError: Sync,
<T as Sink>::SinkItem: Sync,
impl<T, U, S> Unpin for FramedWrite<T, U, S> where
S: Unpin,
T: Unpin,
U: Unpin,
<T as Sink>::SinkError: Unpin,
<T as Sink>::SinkItem: Unpin,
S: Unpin,
T: Unpin,
U: Unpin,
<T as Sink>::SinkError: Unpin,
<T as Sink>::SinkItem: Unpin,
impl<T, U, S> UnwindSafe for FramedWrite<T, U, S> where
S: UnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
<T as Sink>::SinkError: UnwindSafe,
<T as Sink>::SinkItem: UnwindSafe,
S: 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>,