Struct azure_core::headers::Headers
source · pub struct Headers(_);
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>where
V: FromStr<Err = E>,
E: Error + Send + Sync + 'static,
pub fn get_as<V, E>(&self, key: &HeaderName) -> Result<V>where V: FromStr<Err = E>, E: Error + Send + Sync + 'static,
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>>where
V: FromStr<Err = E>,
E: Error + Send + Sync + 'static,
pub fn get_optional_as<V, E>(&self, key: &HeaderName) -> Result<Option<V>>where V: FromStr<Err = E>, E: Error + Send + Sync + 'static,
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>where
F: FnOnce(&'a HeaderValue) -> Result<V, E>,
E: Error + Send + Sync + 'static,
pub fn get_with<'a, V, F, E>(&'a self, key: &HeaderName, parser: F) -> Result<V>where F: FnOnce(&'a HeaderValue) -> Result<V, E>, E: Error + Send + Sync + 'static,
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>>where
F: FnOnce(&'a HeaderValue) -> Result<V, E>,
E: Error + Send + Sync + 'static,
pub fn get_optional_with<'a, V, F, E>( &'a self, key: &HeaderName, parser: F ) -> Result<Option<V>>where F: FnOnce(&'a HeaderValue) -> Result<V, E>, E: Error + Send + Sync + 'static,
Optionally get a header value using the parser or error if it fails to parse
sourcepub fn insert<K, V>(&mut self, key: K, value: V)where
K: Into<HeaderName>,
V: Into<HeaderValue>,
pub fn insert<K, V>(&mut self, key: K, value: V)where K: Into<HeaderName>, V: Into<HeaderValue>,
Insert a header name/value pair
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, RandomState>> for Headers
impl From<HashMap<HeaderName, HeaderValue, RandomState>> 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
§type Item = (HeaderName, HeaderValue)
type Item = (HeaderName, HeaderValue)
The type of the elements being iterated over.
§type IntoIter = IntoIter<HeaderName, HeaderValue>
type IntoIter = IntoIter<HeaderName, HeaderValue>
Which kind of iterator are we turning this into?