pub struct HeadFacts { /* private fields */ }Expand description
The interpreted facts of a request head (method, version, framing,
keep-alive, upgrade and expectation flags, target form, and the spans of
the host and of the target’s parts), so a view can be rebuilt from
copied bytes without parsing them again. Returned by
RequestHead::copy_into, taken by OwnedRequestHead::from_parts.
§Examples
use http_net::{OwnedRequestHead, ServerConn, ServerEvent};
let mut conn = ServerConn::new();
let _ = conn.feed(b"GET /x HTTP/1.1\r\nHost: a\r\n\r\n");
let ServerEvent::Request(req) = conn.poll().unwrap() else { panic!() };
let (mut bytes, mut fields) = (Vec::new(), Vec::new());
let facts = req.copy_into(&mut bytes, &mut fields)?;
let owned = OwnedRequestHead::from_parts(bytes, fields, facts)?;
assert_eq!(owned.view().path(), "/x");Trait Implementations§
impl Copy for HeadFacts
impl Eq for HeadFacts
impl StructuralPartialEq for HeadFacts
Auto Trait Implementations§
impl Freeze for HeadFacts
impl RefUnwindSafe for HeadFacts
impl Send for HeadFacts
impl Sync for HeadFacts
impl Unpin for HeadFacts
impl UnsafeUnpin for HeadFacts
impl UnwindSafe for HeadFacts
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