pub struct OrigHeaderMap(/* private fields */);Expand description
A map from header names to their original casing as received in an HTTP message.
OrigHeaderMap not only preserves the original case of each header name as it appeared
in the request or response, but also maintains the insertion order of headers. This makes
it suitable for use cases where the order of headers matters, such as HTTP/1.x message
serialization, proxying, or reproducing requests/responses exactly as received.
Implementations§
Source§impl OrigHeaderMap
impl OrigHeaderMap
Sourcepub fn new() -> OrigHeaderMap
pub fn new() -> OrigHeaderMap
Creates a new, empty OrigHeaderMap.
Sourcepub fn with_capacity(size: usize) -> OrigHeaderMap
pub fn with_capacity(size: usize) -> OrigHeaderMap
Creates an empty OrigHeaderMap with the specified capacity.
Sourcepub fn insert<N>(&mut self, orig: N) -> boolwhere
N: IntoOrigHeaderName,
pub fn insert<N>(&mut self, orig: N) -> boolwhere
N: IntoOrigHeaderName,
Insert a new header name into the collection.
If the map did not previously have this key present, then false is
returned.
If the map did have this key present, the new value is pushed to the end
of the list of values currently associated with the key. The key is not
updated, though; this matters for types that can be == without being
identical.
Sourcepub fn extend(&mut self, iter: OrigHeaderMap)
pub fn extend(&mut self, iter: OrigHeaderMap)
Extends the map with all entries from another OrigHeaderMap, preserving order.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of headers stored in the map.
This number represents the total number of values stored in the map. This number can be greater than or equal to the number of keys stored given that a single key may have more than one associated value.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&HeaderName, &OrigHeaderName)>
pub fn iter(&self) -> impl Iterator<Item = (&HeaderName, &OrigHeaderName)>
Returns an iterator over all header names and their original spellings, in insertion order.
Trait Implementations§
Source§impl Clone for OrigHeaderMap
impl Clone for OrigHeaderMap
Source§fn clone(&self) -> OrigHeaderMap
fn clone(&self) -> OrigHeaderMap
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OrigHeaderMap
impl Debug for OrigHeaderMap
Source§impl Default for OrigHeaderMap
impl Default for OrigHeaderMap
Source§fn default() -> OrigHeaderMap
fn default() -> OrigHeaderMap
Source§impl<'a> IntoIterator for &'a OrigHeaderMap
impl<'a> IntoIterator for &'a OrigHeaderMap
Source§type Item = (&'a HeaderName, &'a OrigHeaderName)
type Item = (&'a HeaderName, &'a OrigHeaderName)
Source§type IntoIter = <&'a HeaderMap<OrigHeaderName> as IntoIterator>::IntoIter
type IntoIter = <&'a HeaderMap<OrigHeaderName> as IntoIterator>::IntoIter
Source§fn into_iter(self) -> <&'a OrigHeaderMap as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a OrigHeaderMap as IntoIterator>::IntoIter
Source§impl IntoIterator for OrigHeaderMap
impl IntoIterator for OrigHeaderMap
Source§type Item = (Option<HeaderName>, OrigHeaderName)
type Item = (Option<HeaderName>, OrigHeaderName)
Source§type IntoIter = <HeaderMap<OrigHeaderName> as IntoIterator>::IntoIter
type IntoIter = <HeaderMap<OrigHeaderName> as IntoIterator>::IntoIter
Source§fn into_iter(self) -> <OrigHeaderMap as IntoIterator>::IntoIter
fn into_iter(self) -> <OrigHeaderMap as IntoIterator>::IntoIter
Auto Trait Implementations§
impl Freeze for OrigHeaderMap
impl RefUnwindSafe for OrigHeaderMap
impl Send for OrigHeaderMap
impl Sync for OrigHeaderMap
impl Unpin for OrigHeaderMap
impl UnsafeUnpin for OrigHeaderMap
impl UnwindSafe for OrigHeaderMap
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
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>
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>
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