pub struct Headers(/* private fields */);Expand description
A collection of headers
Implementations§
Source§impl Headers
 
impl Headers
pub fn new() -> Self
Sourcepub fn get_optional_string(&self, key: &HeaderName) -> Option<String>
 
pub fn get_optional_string(&self, key: &HeaderName) -> Option<String>
Optionally get a header value as a String
Sourcepub fn get_str(&self, key: &HeaderName) -> Result<&str>
 
pub fn get_str(&self, key: &HeaderName) -> Result<&str>
Get a header value as a str or error if it is not found
Sourcepub fn get_optional_str(&self, key: &HeaderName) -> Option<&str>
 
pub fn get_optional_str(&self, key: &HeaderName) -> Option<&str>
Optionally get a header value as a str
Sourcepub fn get_as<V, E>(&self, key: &HeaderName) -> Result<V>
 
pub fn get_as<V, E>(&self, key: &HeaderName) -> Result<V>
Get a header value parsing it as the type or error if it’s not found or it fails to parse
Sourcepub fn get_optional_as<V, E>(&self, key: &HeaderName) -> Result<Option<V>>
 
pub fn get_optional_as<V, E>(&self, key: &HeaderName) -> Result<Option<V>>
Optionally get a header value parsing it as the type or error if it fails to parse
Sourcepub fn get_with<'a, V, F, E>(&'a self, key: &HeaderName, parser: F) -> Result<V>
 
pub fn get_with<'a, V, F, E>(&'a self, key: &HeaderName, parser: F) -> Result<V>
Get a header value using the parser or error if it is not found or fails to parse
Sourcepub fn get_optional_with<'a, V, F, E>(
    &'a self,
    key: &HeaderName,
    parser: F,
) -> Result<Option<V>>
 
pub fn get_optional_with<'a, V, F, E>( &'a self, key: &HeaderName, parser: F, ) -> Result<Option<V>>
Optionally get a header value using the parser or error if it fails to parse
Sourcepub fn iter(&self) -> impl Iterator<Item = (&HeaderName, &HeaderValue)>
 
pub fn iter(&self) -> impl Iterator<Item = (&HeaderName, &HeaderValue)>
Iterate over all the header name/value pairs
Trait Implementations§
Source§impl From<HashMap<HeaderName, HeaderValue>> for Headers
 
impl From<HashMap<HeaderName, HeaderValue>> for Headers
Source§fn from(c: HashMap<HeaderName, HeaderValue>) -> Self
 
fn from(c: HashMap<HeaderName, HeaderValue>) -> Self
Converts to this type from the input type.
Source§impl From<Headers> for CustomHeaders
 
impl From<Headers> for CustomHeaders
Source§impl IntoIterator for Headers
 
impl IntoIterator for Headers
Source§type Item = (HeaderName, HeaderValue)
 
type Item = (HeaderName, HeaderValue)
The type of the elements being iterated over.
Source§type IntoIter = IntoIter<HeaderName, HeaderValue>
 
type IntoIter = IntoIter<HeaderName, HeaderValue>
Which kind of iterator are we turning this into?
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 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<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to 
key and return true if they are equal.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