pub struct FieldSpan {
pub name: Span,
pub value: Span,
}Expand description
One field line of a head: the name’s span and the value’s span (the value without surrounding whitespace), as offsets into the head bytes.
§Examples
use http_net::{ServerConn, ServerEvent};
let mut conn = ServerConn::new();
let _ = conn.feed(b"GET / HTTP/1.1\r\nHost: a \r\n\r\n");
let ServerEvent::Request(req) = conn.poll().unwrap() else { panic!() };
let raw = req.raw();
let host = raw.fields()[0];
assert_eq!(host.name.get(raw.bytes()), b"Host");
assert_eq!(host.value.get(raw.bytes()), b"a");Fields§
§name: SpanThe field name, as received.
value: SpanThe field value, without leading or trailing whitespace.
Trait Implementations§
impl Copy for FieldSpan
impl Eq for FieldSpan
impl StructuralPartialEq for FieldSpan
Auto Trait Implementations§
impl Freeze for FieldSpan
impl RefUnwindSafe for FieldSpan
impl Send for FieldSpan
impl Sync for FieldSpan
impl Unpin for FieldSpan
impl UnsafeUnpin for FieldSpan
impl UnwindSafe for FieldSpan
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