pub struct FramedWrite<IO, Codec> { /* private fields */ }
Implementations§
Source§impl<IO, Codec> FramedWrite<IO, Codec>
impl<IO, Codec> FramedWrite<IO, Codec>
pub fn new(io: IO, encoder: Codec) -> Self
Sourcepub fn get_ref(&self) -> &IO
pub fn get_ref(&self) -> &IO
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.
Sourcepub fn get_mut(&mut self) -> &mut IO
pub fn get_mut(&mut self) -> &mut IO
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.
Sourcepub fn into_inner(self) -> IO
pub fn into_inner(self) -> IO
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.
Sourcepub fn encoder_mut(&mut self) -> &mut Codec
pub fn encoder_mut(&mut self) -> &mut Codec
Returns a mutable reference to the underlying encoder.
Sourcepub fn map_encoder<CodecNew, F>(self, map: F) -> FramedWrite<IO, CodecNew>where
F: FnOnce(Codec) -> CodecNew,
pub fn map_encoder<CodecNew, F>(self, map: F) -> FramedWrite<IO, CodecNew>where
F: FnOnce(Codec) -> CodecNew,
Maps the encoder E
to C
, preserving the write buffer
wrapped by Framed
.
Sourcepub fn write_buffer(&self) -> &BytesMut
pub fn write_buffer(&self) -> &BytesMut
Returns a reference to the write buffer.
Sourcepub 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.