[−][src]Struct tokio_serde::FramedRead
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.
Implementations
impl<T, U, S> FramedRead<T, U, S> where
T: Stream,
BytesMut: From<T::Item>,
S: Deserializer<U>,
S::Error: Into<T::Error>,
[src][−]
T: Stream,
BytesMut: From<T::Item>,
S: Deserializer<U>,
S::Error: Into<T::Error>,
pub fn new(inner: T, deserializer: S) -> FramedRead<T, U, S>
[src][−]
Creates a new FramedRead
with the given buffer stream and deserializer.
impl<T, U, S> FramedRead<T, U, S>
[src][−]
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<T, U, S> Stream for FramedRead<T, U, S> where
T: Stream,
T::Error: From<S::Error>,
BytesMut: From<T::Item>,
S: Deserializer<U>,
[src][+]
T: Stream,
T::Error: From<S::Error>,
BytesMut: From<T::Item>,
S: Deserializer<U>,
Auto Trait Implementations
impl<T, U, S> RefUnwindSafe for FramedRead<T, U, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U, S> Send for FramedRead<T, U, S> where
S: Send,
T: Send,
U: Send,
S: Send,
T: Send,
U: Send,
impl<T, U, S> Sync for FramedRead<T, U, S> where
S: Sync,
T: Sync,
U: Sync,
S: Sync,
T: Sync,
U: Sync,
impl<T, U, S> Unpin for FramedRead<T, U, S> where
S: Unpin,
T: Unpin,
U: Unpin,
S: Unpin,
T: Unpin,
U: Unpin,
impl<T, U, S> UnwindSafe for FramedRead<T, U, S> where
S: UnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
U: 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>,