pub struct StatefulParser { /* private fields */ }Expand description
Incremental HTTP/1.1 parser that handles partial reads.
Feed bytes via feed. When a full request is available,
returns ParseStatus::Complete. On partial data, returns
ParseStatus::Incomplete.
Implementations§
Source§impl StatefulParser
impl StatefulParser
Sourcepub fn with_max_size(self, size: usize) -> Self
pub fn with_max_size(self, size: usize) -> Self
Set maximum request size.
Sourcepub fn with_limits(self, limits: ParseLimits) -> Self
pub fn with_limits(self, limits: ParseLimits) -> Self
Set all parsing limits.
Sourcepub fn with_body_config(self, config: BodyConfig) -> Self
pub fn with_body_config(self, config: BodyConfig) -> Self
Set the body parsing configuration.
Sourcepub fn buffered_len(&self) -> usize
pub fn buffered_len(&self) -> usize
Returns the current buffered byte count.
Sourcepub fn feed(&mut self, bytes: &[u8]) -> Result<ParseStatus, ParseError>
pub fn feed(&mut self, bytes: &[u8]) -> Result<ParseStatus, ParseError>
Feed new bytes into the parser and attempt to parse a request.
To parse subsequent requests in the buffer, call feed again with
an empty slice after a successful parse.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StatefulParser
impl !RefUnwindSafe for StatefulParser
impl Send for StatefulParser
impl Sync for StatefulParser
impl Unpin for StatefulParser
impl !UnwindSafe for StatefulParser
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).