Struct http_box::http1::Parser
[−]
[src]
pub struct Parser<'a, T: 'a + HttpHandler> { /* fields omitted */ }
HTTP 1.x parser.
Methods
impl<'a, T: 'a + HttpHandler> Parser<'a, T>[src]
fn new() -> Parser<'a, T>
Create a new Parser and initialize it for head parsing.
fn init_chunked(&mut self)
Initialize this Parser for chunked transfer encoding parsing.
fn init_head(&mut self)
Initialize this Parser for head parsing.
fn init_multipart(&mut self)
Initialize this Parser for multipart parsing.
fn init_url_encoded(&mut self)
Initialize this Parser for URL encoded parsing.
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.
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().
fn resume(
&mut self,
handler: &mut T,
stream: &[u8]
) -> Result<Success, ParserError>
&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.
fn set_boundary(&mut self, boundary: &'a [u8])
Set the multipart boundary.
fn set_length(&mut self, length: usize)
Set the URL encoded length.
fn state(&self) -> ParserState
Retrieve the current state.