pub struct Headers { /* private fields */ }Expand description
HTTP Headers with case-insensitive keys as per RFC 7230
Implementations§
Source§impl Headers
impl Headers
Sourcepub fn insert(&mut self, key: impl AsRef<str>, value: impl AsRef<str>)
pub fn insert(&mut self, key: impl AsRef<str>, value: impl AsRef<str>)
Insert a header with case-insensitive key
Sourcepub fn get(&self, key: impl AsRef<str>) -> Option<&str>
pub fn get(&self, key: impl AsRef<str>) -> Option<&str>
Get a header value with case-insensitive key lookup
Sourcepub fn contains_key(&self, key: impl AsRef<str>) -> bool
pub fn contains_key(&self, key: impl AsRef<str>) -> bool
Check if a header exists (case-insensitive)
Sourcepub fn remove(&mut self, key: impl AsRef<str>) -> Option<String>
pub fn remove(&mut self, key: impl AsRef<str>) -> Option<String>
Remove a header (case-insensitive)
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
Iterate over headers with preserved case
Sourcepub fn content_length(&self) -> Option<usize>
pub fn content_length(&self) -> Option<usize>
Parse Content-Length header
Sourcepub fn from_lines<'a>(lines: impl Iterator<Item = &'a str>) -> Self
pub fn from_lines<'a>(lines: impl Iterator<Item = &'a str>) -> Self
Parse headers from HTTP request lines
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