pub struct Headers { /* private fields */ }Implementations§
Source§impl Headers
impl Headers
pub fn new() -> Self
Sourcepub fn set(&mut self, name: &str, value: impl Into<String>)
pub fn set(&mut self, name: &str, value: impl Into<String>)
Replace any existing values for this name.
Sourcepub fn append(&mut self, name: &str, value: impl Into<String>)
pub fn append(&mut self, name: &str, value: impl Into<String>)
Add a value, keeping the ones already present. Used for Set-Cookie,
which is the one header that legitimately repeats.
pub fn get(&self, name: &str) -> Option<&str>
pub fn get_all(&self, name: &str) -> &[String]
pub fn contains(&self, name: &str) -> bool
pub fn remove(&mut self, name: &str)
pub fn is_empty(&self) -> bool
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
Iterate every (name, value) pair, repeated headers included.
Sourcepub fn content_length(&self) -> Option<usize>
pub fn content_length(&self) -> Option<usize>
The parsed Content-Length, when present and well-formed.
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
The media type without parameters: application/json; charset=utf-8 → application/json.
Trait Implementations§
impl Eq for Headers
impl StructuralPartialEq for Headers
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