Struct wire_framed::codec::FramedRead
pub struct FramedRead<T, D> { /* private fields */ }Implementations§
§impl<T, D> FramedRead<T, D>where
T: AsyncRead,
D: Decoder,
impl<T, D> FramedRead<T, D>where T: AsyncRead, D: Decoder,
pub 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.
pub 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.
§impl<T, D> FramedRead<T, D>
impl<T, D> FramedRead<T, D>
pub 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.
pub 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.
pub fn get_pin_mut(self: Pin<&mut FramedRead<T, D>>) -> Pin<&mut T>
pub fn get_pin_mut(self: Pin<&mut FramedRead<T, D>>) -> 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.
pub 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.
pub fn decoder_mut(&mut self) -> &mut D
pub fn decoder_mut(&mut self) -> &mut D
Returns a mutable reference to the underlying decoder.
pub 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.
pub fn decoder_pin_mut(self: Pin<&mut FramedRead<T, D>>) -> &mut D
pub fn decoder_pin_mut(self: Pin<&mut FramedRead<T, D>>) -> &mut D
Returns a mutable reference to the underlying decoder.
pub fn read_buffer(&self) -> &BytesMut
pub fn read_buffer(&self) -> &BytesMut
Returns a reference to the read buffer.
pub 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§
§impl<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,
§impl<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>,
§fn poll_ready(
self: Pin<&mut FramedRead<T, D>>,
cx: &mut Context<'_>
) -> Poll<Result<(), <FramedRead<T, D> as Sink<I>>::Error>>
fn poll_ready( self: Pin<&mut FramedRead<T, D>>, cx: &mut Context<'_> ) -> Poll<Result<(), <FramedRead<T, D> as Sink<I>>::Error>>
Sink to receive a value. Read more§fn start_send(
self: Pin<&mut FramedRead<T, D>>,
item: I
) -> Result<(), <FramedRead<T, D> as Sink<I>>::Error>
fn start_send( self: Pin<&mut FramedRead<T, D>>, item: I ) -> Result<(), <FramedRead<T, D> as Sink<I>>::Error>
poll_ready which returned Poll::Ready(Ok(())). Read more§fn poll_flush(
self: Pin<&mut FramedRead<T, D>>,
cx: &mut Context<'_>
) -> Poll<Result<(), <FramedRead<T, D> as Sink<I>>::Error>>
fn poll_flush( self: Pin<&mut FramedRead<T, D>>, cx: &mut Context<'_> ) -> Poll<Result<(), <FramedRead<T, D> as Sink<I>>::Error>>
§fn poll_close(
self: Pin<&mut FramedRead<T, D>>,
cx: &mut Context<'_>
) -> Poll<Result<(), <FramedRead<T, D> as Sink<I>>::Error>>
fn poll_close( self: Pin<&mut FramedRead<T, D>>, cx: &mut Context<'_> ) -> Poll<Result<(), <FramedRead<T, D> as Sink<I>>::Error>>
§impl<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,
§fn poll_next(
self: Pin<&mut FramedRead<T, D>>,
cx: &mut Context<'_>
) -> Poll<Option<<FramedRead<T, D> as Stream>::Item>>
fn poll_next( self: Pin<&mut FramedRead<T, D>>, cx: &mut Context<'_> ) -> Poll<Option<<FramedRead<T, D> as Stream>::Item>>
None if the stream is exhausted. Read more