pub struct Header(/* private fields */);Expand description
HTTP headers — a multi-valued map with case-insensitive canonical keys.
Keys are stored in canonical form (“Content-Type”, not “content-type”).
Mirrors Go’s http.Header.
Implementations§
Source§impl Header
impl Header
pub fn new() -> Self
Sourcepub fn canonical_key(s: &str) -> String
pub fn canonical_key(s: &str) -> String
Canonical form of a header key: “content-type” → “Content-Type”.
Sourcepub fn set(&mut self, key: &str, value: impl Into<String>)
pub fn set(&mut self, key: &str, value: impl Into<String>)
Set the key to a single value, replacing any existing values.
Sourcepub fn add(&mut self, key: &str, value: impl Into<String>)
pub fn add(&mut self, key: &str, value: impl Into<String>)
Add a value to the key without replacing existing values.
Trait Implementations§
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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