pub struct Headers(/* private fields */);Expand description
Case-insensitive header collection.
Stored as a list rather than a map because HTTP allows repeated headers and the order occasionally matters.
Implementations§
Source§impl Headers
impl Headers
pub fn new() -> Self
pub fn insert(&mut self, name: impl Into<String>, value: impl Into<String>)
pub fn append(&mut self, name: impl Into<String>, value: impl Into<String>)
pub fn get(&self, name: &str) -> Option<&str>
Sourcepub fn get_u64(&self, name: &str) -> Option<u64>
pub fn get_u64(&self, name: &str) -> Option<u64>
Parse a header value as a number, ignoring anything unparseable.
A malformed rate-limit header is not worth failing a request over.
pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Trait Implementations§
Source§impl Debug for Headers
Redacting Debug.
impl Debug for Headers
Redacting Debug.
A tracing::debug!(?headers, ...) anywhere in the stack would otherwise print
bearer tokens into the log file.
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