pub struct Headers { /* private fields */ }Expand description
Ordered headers for requests and responses.
This preserves insertion order for fingerprinting while providing convenient lookup and mutation helpers.
Implementations§
Source§impl Headers
impl Headers
pub fn new() -> Self
pub fn from_vec(headers: Vec<(String, String)>) -> Self
pub fn from_static(headers: Vec<(&'static str, &'static str)>) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
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 remove(&mut self, name: &str) -> Option<Vec<String>>
pub fn get(&self, name: &str) -> Option<&str>
pub fn get_all(&self, name: &str) -> Vec<&str>
pub fn contains(&self, name: &str) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>
pub fn iter_ordered(&self) -> impl Iterator<Item = (&str, &str)>
pub fn extend(&mut self, other: Headers)
pub fn as_slice(&self) -> &[(String, String)]
pub fn as_refs(&self) -> Vec<(&str, &str)>
pub fn to_vec(&self) -> Vec<(String, String)>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more