pub struct ReqParser { /* private fields */ }
Expand description
A single Instance of the RequestParser that is used to parse HTTP-Requests
Implementations§
Source§impl ReqParser
impl ReqParser
Sourcepub fn new_capacity(cap: usize) -> Self
pub fn new_capacity(cap: usize) -> Self
Creates a new Request-Parser with the given capacity as its pre-reserved capacity to store the Head of the Request
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the internal Buffers and resets everything to be ready to receive and parse a new request
This should be the prefered way to parse mulitple sequential requests, as this avoids extra allocations
Sourcepub fn block_parse(&mut self, bytes: &[u8]) -> (bool, Option<usize>)
pub fn block_parse(&mut self, bytes: &[u8]) -> (bool, Option<usize>)
Returns a touple that stands for (done, data-left-in-buffer)
Explanation:
done
: True if the request has been fully received and parseddata-left-in-buffer
: The Amount of bytes at the end of the given slice that were unused
Sourcepub fn finish<'a, 'b>(&'a self) -> ParseResult<Request<'b>>where
'a: 'b,
pub fn finish<'a, 'b>(&'a self) -> ParseResult<Request<'b>>where
'a: 'b,
Finishes up the parsing and finalizes all the Data it received and returns a Request-Instance containing the parsed out Request
Auto Trait Implementations§
impl Freeze for ReqParser
impl RefUnwindSafe for ReqParser
impl Send for ReqParser
impl Sync for ReqParser
impl Unpin for ReqParser
impl UnwindSafe for ReqParser
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