Struct tokio_util::codec::FramedRead
source · [−]pub struct FramedRead<T, D> { /* private fields */ }
Implementations
sourceimpl<T, D> FramedRead<T, D> where
T: AsyncRead,
D: Decoder,
impl<T, D> FramedRead<T, D> where
T: AsyncRead,
D: Decoder,
sourcepub fn new(inner: T, decoder: D) -> FramedRead<T, D>
pub fn new(inner: T, decoder: D) -> FramedRead<T, D>
Creates a new FramedRead
with the given decoder
.
sourcepub fn with_capacity(inner: T, decoder: D, capacity: usize) -> FramedRead<T, D>
pub 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.
sourceimpl<T, D> FramedRead<T, D>
impl<T, D> FramedRead<T, D>
sourcepub fn get_ref(&self) -> &T
pub fn get_ref(&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.
sourcepub fn get_mut(&mut self) -> &mut T
pub fn get_mut(&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.
sourcepub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>
pub 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.
sourcepub fn into_inner(self) -> T
pub fn into_inner(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.
sourcepub fn decoder_mut(&mut self) -> &mut D
pub fn decoder_mut(&mut self) -> &mut D
Returns a mutable reference to the underlying decoder.
sourcepub fn map_decoder<C, F>(self, map: F) -> FramedRead<T, C> where
F: FnOnce(D) -> C,
pub fn map_decoder<C, F>(self, map: F) -> FramedRead<T, C> where
F: FnOnce(D) -> C,
Maps the decoder D
to C
, preserving the read buffer
wrapped by Framed
.
sourcepub fn decoder_pin_mut(self: Pin<&mut Self>) -> &mut D
pub fn decoder_pin_mut(self: Pin<&mut Self>) -> &mut D
Returns a mutable reference to the underlying decoder.
sourcepub fn read_buffer(&self) -> &BytesMut
pub fn read_buffer(&self) -> &BytesMut
Returns a reference to the read buffer.
sourcepub fn read_buffer_mut(&mut self) -> &mut BytesMut
pub fn read_buffer_mut(&mut self) -> &mut BytesMut
Returns a mutable reference to the read buffer.
Trait Implementations
sourceimpl<T, D> Debug for FramedRead<T, D> where
T: Debug,
D: Debug,
impl<T, D> Debug for FramedRead<T, D> where
T: Debug,
D: Debug,
sourceimpl<T, I, D> Sink<I> for FramedRead<T, D> where
T: Sink<I>,
impl<T, I, D> Sink<I> for FramedRead<T, D> where
T: Sink<I>,
sourcefn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>
fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<(), Self::Error>>
Attempts to prepare the Sink
to receive a value. Read more
sourcefn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: I) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready
which returned Poll::Ready(Ok(()))
. Read more
sourceimpl<T, D> Stream for FramedRead<T, D> where
T: AsyncRead,
D: Decoder,
impl<T, D> Stream for FramedRead<T, D> where
T: AsyncRead,
D: Decoder,
impl<'__pin, T, D> Unpin for FramedRead<T, D> where
__Origin<'__pin, T, D>: Unpin,
Auto Trait Implementations
impl<T, D> RefUnwindSafe for FramedRead<T, D> where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, D> Send for FramedRead<T, D> where
D: Send,
T: Send,
impl<T, D> Sync for FramedRead<T, D> where
D: Sync,
T: Sync,
impl<T, D> UnwindSafe for FramedRead<T, D> where
D: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<S, T, E> TryStream for S where
S: Stream<Item = Result<T, E>> + ?Sized,
impl<S, T, E> TryStream for S where
S: Stream<Item = Result<T, E>> + ?Sized,
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more