Struct FramedRead

struct FramedRead<T, D> { ... }

A Stream of messages decoded from an AsyncRead.

For examples of how to use FramedRead with a codec, see the examples on the codec module.

Cancellation safety

Implementations

impl<T, D> FramedRead<T, D>

fn new(inner: T, decoder: D) -> FramedRead<T, D>

Creates a new FramedRead with the given decoder.

fn with_capacity(inner: T, decoder: D, capacity: usize) -> FramedRead<T, D>

Creates a new FramedRead with the given decoder and a buffer of capacity initial size.

impl<T, D> FramedRead<T, D>

fn get_ref(self: &Self) -> &T

Returns a reference to the underlying I/O 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.

fn get_mut(self: &mut Self) -> &mut T

Returns a mutable reference to the underlying I/O 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.

fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>

Returns a pinned mutable reference to the underlying I/O 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.

fn into_inner(self: Self) -> T

Consumes the FramedRead, returning its underlying I/O 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.

fn decoder(self: &Self) -> &D

Returns a reference to the underlying decoder.

fn decoder_mut(self: &mut Self) -> &mut D

Returns a mutable reference to the underlying decoder.

fn map_decoder<C, F>(self: Self, map: F) -> FramedRead<T, C>
where
    F: FnOnce(D) -> C

Maps the decoder D to C, preserving the read buffer wrapped by Framed.

fn decoder_pin_mut(self: Pin<&mut Self>) -> &mut D

Returns a mutable reference to the underlying decoder.

fn read_buffer(self: &Self) -> &BytesMut

Returns a reference to the read buffer.

fn read_buffer_mut(self: &mut Self) -> &mut BytesMut

Returns a mutable reference to the read buffer.

impl<'__pin, T, D> Unpin for FramedRead<T, D>

impl<S, T, E> TryStream for FramedRead<T, D>

fn try_poll_next(self: Pin<&mut S>, cx: &mut Context<'_>) -> Poll<Option<Result<<S as TryStream>::Ok, <S as TryStream>::Error>>>

impl<T> Any for FramedRead<T, D>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for FramedRead<T, D>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for FramedRead<T, D>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for FramedRead<T, D>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, D> Debug for FramedRead<T, D>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T, D> Freeze for FramedRead<T, D>

impl<T, D> RefUnwindSafe for FramedRead<T, D>

impl<T, D> Send for FramedRead<T, D>

impl<T, D> Stream for FramedRead<T, D>

fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<<Self as >::Item>>

impl<T, D> Sync for FramedRead<T, D>

impl<T, D> UnsafeUnpin for FramedRead<T, D>

impl<T, D> UnwindSafe for FramedRead<T, D>

impl<T, I, D> Sink for FramedRead<T, D>

fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), <Self as >::Error>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>

impl<T, U> Into for FramedRead<T, D>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for FramedRead<T, D>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for FramedRead<T, D>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>