Struct azure_core::headers::Headers

source ·
pub struct Headers(_);
Expand description

A collection of headers

Implementations§

source§

impl Headers

source

pub fn new() -> Self

source

pub fn get_optional_string(&self, key: &HeaderName) -> Option<String>

Optionally get a header value as a String

source

pub fn get_str(&self, key: &HeaderName) -> Result<&str>

Get a header value as a str or error if it is not found

source

pub fn get_optional_str(&self, key: &HeaderName) -> Option<&str>

Optionally get a header value as a str

source

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

source

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

source

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

source

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

source

pub fn insert<K, V>(&mut self, key: K, value: V)where K: Into<HeaderName>, V: Into<HeaderValue>,

Insert a header name/value pair

source

pub fn add<H>(&mut self, header: H)where H: AsHeaders,

Add headers to the headers collection

source

pub fn iter(&self) -> impl Iterator<Item = (&HeaderName, &HeaderValue)>

Iterate over all the header name/value pairs

Trait Implementations§

source§

impl Clone for Headers

source§

fn clone(&self) -> Headers

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Headers

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Headers

source§

fn default() -> Headers

Returns the “default value” for a type. Read more
source§

impl From<&Headers> for Metadata

source§

fn from(header_map: &Headers) -> Self

Converts to this type from the input type.
source§

impl From<HashMap<HeaderName, HeaderValue, RandomState>> for Headers

source§

fn from(c: HashMap<HeaderName, HeaderValue>) -> Self

Converts to this type from the input type.
source§

impl From<Headers> for CustomHeaders

source§

fn from(h: Headers) -> Self

Converts to this type from the input type.
source§

impl IntoIterator for Headers

§

type Item = (HeaderName, HeaderValue)

The type of the elements being iterated over.
§

type IntoIter = IntoIter<HeaderName, HeaderValue>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<Headers> for Headers

source§

fn eq(&self, other: &Headers) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Headers

source§

impl StructuralEq for Headers

source§

impl StructuralPartialEq for Headers

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V