pub struct Headers { /* private fields */ }Expand description
Represents HTTP headers with support for multiple values per key.
Implementations§
Source§impl Headers
impl Headers
Sourcepub fn insert(&mut self, name: impl Into<HeaderName>, value: impl Into<String>)
pub fn insert(&mut self, name: impl Into<HeaderName>, value: impl Into<String>)
Insert a header, replacing any existing values.
Sourcepub fn append(&mut self, name: impl Into<HeaderName>, value: impl Into<String>)
pub fn append(&mut self, name: impl Into<HeaderName>, value: impl Into<String>)
Append a header value (for headers that can have multiple values).
Sourcepub fn get(&self, name: impl Into<HeaderName>) -> Option<&str>
pub fn get(&self, name: impl Into<HeaderName>) -> Option<&str>
Get the first value for a header (most common use case).
Sourcepub fn get_all(&self, name: impl Into<HeaderName>) -> Option<&[String]>
pub fn get_all(&self, name: impl Into<HeaderName>) -> Option<&[String]>
Get all values for a header.
Sourcepub fn contains(&self, name: impl Into<HeaderName>) -> bool
pub fn contains(&self, name: impl Into<HeaderName>) -> bool
Check if a header exists.
Sourcepub fn remove(&mut self, name: impl Into<HeaderName>) -> Option<Vec<String>>
pub fn remove(&mut self, name: impl Into<HeaderName>) -> Option<Vec<String>>
Remove a header and return its values.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Headers
impl RefUnwindSafe for Headers
impl Send for Headers
impl Sync for Headers
impl Unpin for Headers
impl UnsafeUnpin for Headers
impl UnwindSafe for Headers
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