Struct monoio_http::h1::FramedRead
source · pub struct FramedRead<IO, Codec> { /* private fields */ }
Implementations§
source§impl<IO, Codec> FramedRead<IO, Codec>
impl<IO, Codec> FramedRead<IO, Codec>
pub fn new(io: IO, decoder: Codec) -> FramedRead<IO, Codec>
pub fn with_capacity( io: IO, codec: Codec, capacity: usize ) -> FramedRead<IO, Codec>
sourcepub fn get_ref(&self) -> &IO
pub fn get_ref(&self) -> &IO
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 IO
pub fn get_mut(&mut self) -> &mut IO
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 into_inner(self) -> IO
pub fn into_inner(self) -> IO
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 Codec
pub fn decoder_mut(&mut self) -> &mut Codec
Returns a mutable reference to the underlying decoder.
sourcepub fn map_decoder<CodecNew, F>(self, map: F) -> FramedRead<IO, CodecNew>where
F: FnOnce(Codec) -> CodecNew,
pub fn map_decoder<CodecNew, F>(self, map: F) -> FramedRead<IO, CodecNew>where F: FnOnce(Codec) -> CodecNew,
Maps the decoder D
to C
, preserving the read buffer
wrapped by Framed
.
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§
source§impl<Codec, IO, AnyCodec> NextWithCodec<Codec> for FramedRead<IO, AnyCodec>where
Codec: Decoder,
IO: AsyncReadRent,
impl<Codec, IO, AnyCodec> NextWithCodec<Codec> for FramedRead<IO, AnyCodec>where Codec: Decoder, IO: AsyncReadRent,
type Item = Result<<Codec as Decoder>::Item, <Codec as Decoder>::Error>
type NextFuture<'a> = impl Future<Output = Option<<FramedRead<IO, AnyCodec> as NextWithCodec<Codec>>::Item>> + 'a where FramedRead<IO, AnyCodec>: 'a, Codec: 'a
fn next_with<'a>( &'a mut self, codec: &'a mut Codec ) -> <FramedRead<IO, AnyCodec> as NextWithCodec<Codec>>::NextFuture<'a>
source§impl<IO, Codec> Stream for FramedRead<IO, Codec>where
IO: AsyncReadRent,
Codec: Decoder,
impl<IO, Codec> Stream for FramedRead<IO, Codec>where IO: AsyncReadRent, Codec: Decoder,
§type NextFuture<'a> = <FramedInner<IO, Codec, ReadState> as Stream>::NextFuture<'a>
where
FramedRead<IO, Codec>: 'a
type NextFuture<'a> = <FramedInner<IO, Codec, ReadState> as Stream>::NextFuture<'a> where FramedRead<IO, Codec>: 'a
source§fn next(&mut self) -> <FramedRead<IO, Codec> as Stream>::NextFuture<'_>
fn next(&mut self) -> <FramedRead<IO, Codec> as Stream>::NextFuture<'_>
None
if the stream is exhausted.