pub struct Parser<'a, T: HttpHandler + 'a> { /* private fields */ }Expand description
HTTP 1.x parser.
Implementations§
Source§impl<'a, T: HttpHandler + 'a> Parser<'a, T>
impl<'a, T: HttpHandler + 'a> Parser<'a, T>
Sourcepub fn init_chunked(&mut self)
pub fn init_chunked(&mut self)
Initialize this Parser for chunked transfer encoding parsing.
Sourcepub fn init_multipart(&mut self)
pub fn init_multipart(&mut self)
Initialize this Parser for multipart parsing.
Sourcepub fn init_url_encoded(&mut self)
pub fn init_url_encoded(&mut self)
Initialize this Parser for URL encoded parsing.
Sourcepub fn byte_count(&self) -> usize
pub fn byte_count(&self) -> usize
Retrieve the total byte count processed since the instantiation of Parser.
The byte count is updated when resume() completes. This means that if a
call to byte_count() is executed from within a callback, it will be accurate within
stream.len() bytes. For precise accuracy, the best time to retrieve the byte count is
outside of all callbacks.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset Parser to its initial state.
After each call to reset(), don’t forget to also set the multipart boundary, or URL
encoded data length using set_boundary() or set_length().
Sourcepub fn resume(
&mut self,
handler: &mut T,
stream: &[u8],
) -> Result<Success, ParserError>
pub fn resume( &mut self, handler: &mut T, stream: &[u8], ) -> Result<Success, ParserError>
Resume parsing an additional slice of data.
§Arguments
handler
The handler implementation.
stream
The stream of data to be parsed.
Sourcepub fn set_boundary(&mut self, boundary: &'a [u8])
pub fn set_boundary(&mut self, boundary: &'a [u8])
Set the multipart boundary.
Sourcepub fn set_length(&mut self, length: usize)
pub fn set_length(&mut self, length: usize)
Set the URL encoded length.
Sourcepub fn state(&self) -> ParserState
pub fn state(&self) -> ParserState
Retrieve the current state.