HeaderMap

Struct HeaderMap 

Source
pub struct HeaderMap(/* private fields */);

Implementations§

Source§

impl HeaderMap

Source

pub fn new() -> HeaderMap

Creates a new empty HeaderMap.

Source

pub fn append<V>(&mut self, key: HeaderName, value: V) -> bool
where V: Into<HeaderValues>,

Appends the values if the key is already present or inserts the key-value pair into the map.

Returns true if the map had the key present already.

Source

pub fn clear(&mut self)

Source

pub fn contains_key<Q>(&self, k: &Q) -> bool
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn drain(&mut self) -> Drain<'_>

Source

pub fn entry(&mut self, key: HeaderName) -> Entry<'_>

Source

pub fn get<Q>(&self, k: &Q) -> Option<&HeaderValues>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn get_first<Q>(&self, k: &Q) -> Option<&HeaderValue>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn get_key_values<Q>(&self, k: &Q) -> Option<(&HeaderName, &HeaderValues)>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn get_first_key_value<Q>( &self, k: &Q, ) -> Option<(&HeaderName, &HeaderValue)>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut HeaderValues>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn get_first_mut<Q>(&mut self, k: &Q) -> Option<&mut HeaderValue>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn insert<V>(&mut self, key: HeaderName, values: V) -> Option<HeaderValues>
where V: Into<HeaderValues>,

Inserts a key-values pair into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the values are replaced, and the old values are returned.

Source

pub fn into_keys(self) -> IntoKeys

Source

pub fn into_values(self) -> IntoValues

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> Iter<'_>

Source

pub fn iter_mut(&mut self) -> IterMut<'_>

Source

pub fn keys(&self) -> Keys<'_>

Source

pub fn len(&self) -> usize

Source

pub fn remove<Q>(&mut self, k: &Q) -> Option<HeaderValues>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn remove_entry<Q>(&mut self, k: &Q) -> Option<(HeaderName, HeaderValues)>
where HeaderName: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted in the HeaderMap. The collection may reserve more space to avoid frequent reallocations.

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&HeaderName, &mut HeaderValues) -> bool,

Source

pub fn shrink_to(&mut self, min_capacity: usize)

Source

pub fn shrink_to_fit(&mut self)

Source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Tries to reserve capacity for at least additional more elements to be inserted in the HeaderMap. The collection may reserve more space to avoid frequent reallocations.

Source

pub fn values(&self) -> Values<'_>

Source

pub fn values_mut(&mut self) -> ValuesMut<'_>

Source

pub fn with_capacity(capacity: usize) -> HeaderMap

Trait Implementations§

Source§

impl Clone for HeaderMap

Source§

fn clone(&self) -> HeaderMap

Returns a duplicate 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 HeaderMap

Source§

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

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

impl Default for HeaderMap

Source§

fn default() -> HeaderMap

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

impl Extend<(HeaderName, HeaderValue)> for HeaderMap

Source§

fn extend<T>(&mut self, iter: T)
where T: IntoIterator<Item = (HeaderName, HeaderValue)>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<(HeaderName, HeaderValues)> for HeaderMap

Source§

fn extend<T>(&mut self, iter: T)
where T: IntoIterator<Item = (HeaderName, HeaderValues)>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, const N: usize> From<[(HeaderName, HeaderValue); N]> for HeaderMap

Source§

fn from(array: [(HeaderName, HeaderValue); N]) -> HeaderMap

Converts to this type from the input type.
Source§

impl<'a, const N: usize> From<[(HeaderName, HeaderValues); N]> for HeaderMap

Source§

fn from(array: [(HeaderName, HeaderValues); N]) -> HeaderMap

Converts to this type from the input type.
Source§

impl FromIterator<(HeaderName, HeaderValue)> for HeaderMap

Source§

fn from_iter<T>(iter: T) -> HeaderMap
where T: IntoIterator<Item = (HeaderName, HeaderValue)>,

Creates a value from an iterator. Read more
Source§

impl FromIterator<(HeaderName, HeaderValues)> for HeaderMap

Source§

fn from_iter<T>(iter: T) -> HeaderMap
where T: IntoIterator<Item = (HeaderName, HeaderValues)>,

Creates a value from an iterator. Read more
Source§

impl<'map> IntoIterator for &'map HeaderMap

Source§

type Item = (&'map HeaderName, &'map HeaderValues)

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'map>

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

fn into_iter(self) -> <&'map HeaderMap as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'map> IntoIterator for &'map mut HeaderMap

Source§

type Item = (&'map HeaderName, &'map mut HeaderValues)

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'map>

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

fn into_iter(self) -> <&'map mut HeaderMap as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for HeaderMap

Source§

type Item = (HeaderName, HeaderValues)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter

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

fn into_iter(self) -> <HeaderMap as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for HeaderMap

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for HeaderMap

Source§

impl StructuralPartialEq for HeaderMap

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.