Struct wire_framed::codec::FramedWrite
pub struct FramedWrite<T, E> { /* private fields */ }Expand description
A Sink of frames encoded to an AsyncWrite.
Implementations§
§impl<T, E> FramedWrite<T, E>where
T: AsyncWrite,
impl<T, E> FramedWrite<T, E>where T: AsyncWrite,
pub fn new(inner: T, encoder: E) -> FramedWrite<T, E>
pub fn new(inner: T, encoder: E) -> FramedWrite<T, E>
Creates a new FramedWrite with the given encoder.
§impl<T, E> FramedWrite<T, E>
impl<T, E> FramedWrite<T, E>
pub fn get_ref(&self) -> &T
pub fn get_ref(&self) -> &T
Returns a reference to the underlying I/O stream wrapped by
FramedWrite.
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
FramedWrite.
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 FramedWrite<T, E>>) -> Pin<&mut T>
pub fn get_pin_mut(self: Pin<&mut FramedWrite<T, E>>) -> Pin<&mut T>
Returns a pinned mutable reference to the underlying I/O stream wrapped by
FramedWrite.
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 FramedWrite, 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 encoder_mut(&mut self) -> &mut E
pub fn encoder_mut(&mut self) -> &mut E
Returns a mutable reference to the underlying encoder.
pub fn map_encoder<C, F>(self, map: F) -> FramedWrite<T, C>where
F: FnOnce(E) -> C,
pub fn map_encoder<C, F>(self, map: F) -> FramedWrite<T, C>where F: FnOnce(E) -> C,
Maps the encoder E to C, preserving the write buffer
wrapped by Framed.
pub fn encoder_pin_mut(self: Pin<&mut FramedWrite<T, E>>) -> &mut E
pub fn encoder_pin_mut(self: Pin<&mut FramedWrite<T, E>>) -> &mut E
Returns a mutable reference to the underlying encoder.
pub fn write_buffer(&self) -> &BytesMut
pub fn write_buffer(&self) -> &BytesMut
Returns a reference to the write buffer.
pub fn write_buffer_mut(&mut self) -> &mut BytesMut
pub fn write_buffer_mut(&mut self) -> &mut BytesMut
Returns a mutable reference to the write buffer.
pub fn backpressure_boundary(&self) -> usize
pub fn backpressure_boundary(&self) -> usize
Returns backpressure boundary
pub fn set_backpressure_boundary(&mut self, boundary: usize)
pub fn set_backpressure_boundary(&mut self, boundary: usize)
Updates backpressure boundary
Trait Implementations§
§impl<T, U> Debug for FramedWrite<T, U>where
T: Debug,
U: Debug,
impl<T, U> Debug for FramedWrite<T, U>where T: Debug, U: Debug,
§impl<T, I, E> Sink<I> for FramedWrite<T, E>where
T: AsyncWrite,
E: Encoder<I>,
<E as Encoder<I>>::Error: From<Error>,
impl<T, I, E> Sink<I> for FramedWrite<T, E>where T: AsyncWrite, E: Encoder<I>, <E as Encoder<I>>::Error: From<Error>,
§fn poll_ready(
self: Pin<&mut FramedWrite<T, E>>,
cx: &mut Context<'_>
) -> Poll<Result<(), <FramedWrite<T, E> as Sink<I>>::Error>>
fn poll_ready( self: Pin<&mut FramedWrite<T, E>>, cx: &mut Context<'_> ) -> Poll<Result<(), <FramedWrite<T, E> as Sink<I>>::Error>>
Sink to receive a value. Read more§fn start_send(
self: Pin<&mut FramedWrite<T, E>>,
item: I
) -> Result<(), <FramedWrite<T, E> as Sink<I>>::Error>
fn start_send( self: Pin<&mut FramedWrite<T, E>>, item: I ) -> Result<(), <FramedWrite<T, E> as Sink<I>>::Error>
poll_ready which returned Poll::Ready(Ok(())). Read more§fn poll_flush(
self: Pin<&mut FramedWrite<T, E>>,
cx: &mut Context<'_>
) -> Poll<Result<(), <FramedWrite<T, E> as Sink<I>>::Error>>
fn poll_flush( self: Pin<&mut FramedWrite<T, E>>, cx: &mut Context<'_> ) -> Poll<Result<(), <FramedWrite<T, E> as Sink<I>>::Error>>
§fn poll_close(
self: Pin<&mut FramedWrite<T, E>>,
cx: &mut Context<'_>
) -> Poll<Result<(), <FramedWrite<T, E> as Sink<I>>::Error>>
fn poll_close( self: Pin<&mut FramedWrite<T, E>>, cx: &mut Context<'_> ) -> Poll<Result<(), <FramedWrite<T, E> as Sink<I>>::Error>>
§impl<T, D> Stream for FramedWrite<T, D>where
T: Stream,
impl<T, D> Stream for FramedWrite<T, D>where T: Stream,
§fn poll_next(
self: Pin<&mut FramedWrite<T, D>>,
cx: &mut Context<'_>
) -> Poll<Option<<FramedWrite<T, D> as Stream>::Item>>
fn poll_next( self: Pin<&mut FramedWrite<T, D>>, cx: &mut Context<'_> ) -> Poll<Option<<FramedWrite<T, D> as Stream>::Item>>
None if the stream is exhausted. Read more