pub struct RequestDecoder { /* private fields */ }
Expand description
A decoder for HTTP requests that handles both headers and payload
The decoder operates in two phases:
- Header parsing: Decodes the request headers using [
HeaderDecoder
] - Payload parsing: If present, decodes the request body using [
PayloadDecoder
]
§State Machine
The decoder maintains its state through the payload_decoder
field:
None
: Currently parsing headersSome(PayloadDecoder)
: Currently parsing payload
Implementations§
Trait Implementations§
Source§impl Decoder for RequestDecoder
impl Decoder for RequestDecoder
Source§fn decode(
&mut self,
src: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error>
fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>
Attempts to decode an HTTP request from the provided buffer
§Returns
Ok(Some(Message::Header(_)))
: Successfully decoded request headersOk(Some(Message::Payload(_)))
: Successfully decoded a payload chunkOk(None)
: Need more data to proceedErr(_)
: Encountered a parsing error
Source§type Item = Message<(RequestHeader, PayloadSize)>
type Item = Message<(RequestHeader, PayloadSize)>
The type of decoded frames.
Source§type Error = ParseError
type Error = ParseError
The type of unrecoverable frame decoding errors. Read more
Auto Trait Implementations§
impl Freeze for RequestDecoder
impl RefUnwindSafe for RequestDecoder
impl Send for RequestDecoder
impl Sync for RequestDecoder
impl Unpin for RequestDecoder
impl UnwindSafe for RequestDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more