pub struct RequestReader { /* private fields */ }Expand description
Sans-IO HTTP/1.x request parser.
§Usage
use nexus_web::http::RequestReader;
let mut reader = RequestReader::new(4096);
reader.read(b"GET / HTTP/1.1\r\nHost: example.com\r\n\r\n").unwrap();
let req = reader.next().unwrap().unwrap();
assert_eq!(req.method, "GET");
assert_eq!(req.path, "/");
assert_eq!(req.header("Host"), Some("example.com"));Implementations§
Source§impl RequestReader
impl RequestReader
Sourcepub fn max_headers(self, n: usize) -> Self
pub fn max_headers(self, n: usize) -> Self
Set maximum number of headers. Default: 64.
Sourcepub fn max_head_size(self, n: usize) -> Self
pub fn max_head_size(self, n: usize) -> Self
Set maximum head size. Default: 8KB.
Sourcepub fn spare(&mut self) -> &mut [u8] ⓘ
pub fn spare(&mut self) -> &mut [u8] ⓘ
Writable region for direct in-buffer writes. Pair with
filled() to commit bytes after the write.
Used by crate::WireStream to deliver bytes from a transport
without a slice intermediate.
Trait Implementations§
Source§impl ParserSink for RequestReader
Lets a WireStream feed bytes directly into
the RequestReader’s spare region — one fewer copy than going
through a slice intermediary.
impl ParserSink for RequestReader
Lets a WireStream feed bytes directly into
the RequestReader’s spare region — one fewer copy than going
through a slice intermediary.
Auto Trait Implementations§
impl Freeze for RequestReader
impl RefUnwindSafe for RequestReader
impl Send for RequestReader
impl Sync for RequestReader
impl Unpin for RequestReader
impl UnsafeUnpin for RequestReader
impl UnwindSafe for RequestReader
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