pub struct HeaderMap { /* private fields */ }Expand description
A set of NATS headers
HeaderMap is a multimap of HeaderName.
Implementations§
Source§impl HeaderMap
impl HeaderMap
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create an empty HeaderMap
The map will be created without any capacity. This function will not allocate.
Consider using the FromIterator, Extend implementations if the final
length is known upfront.
pub fn get(&self, name: &HeaderName) -> Option<&HeaderValue>
pub fn get_all<'a>( &'a self, name: &HeaderName, ) -> impl DoubleEndedIterator<Item = &'a HeaderValue> + use<'a>
pub fn insert(&mut self, name: HeaderName, value: HeaderValue)
pub fn append(&mut self, name: HeaderName, value: HeaderValue)
pub fn remove(&mut self, name: &HeaderName)
Sourcepub fn keys_len(&self) -> usize
pub fn keys_len(&self) -> usize
Returns the number of keys stored in the map
This number will be less than or equal to HeaderMap::len.
Trait Implementations§
Source§impl Extend<(HeaderName, HeaderValue)> for HeaderMap
impl Extend<(HeaderName, HeaderValue)> for HeaderMap
Source§fn extend<T: IntoIterator<Item = (HeaderName, HeaderValue)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (HeaderName, HeaderValue)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
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)
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 FromIterator<(HeaderName, HeaderValue)> for HeaderMap
impl FromIterator<(HeaderName, HeaderValue)> for HeaderMap
Source§fn from_iter<I: IntoIterator<Item = (HeaderName, HeaderValue)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (HeaderName, HeaderValue)>>(iter: I) -> Self
Creates a value from an iterator. Read more
impl Eq for HeaderMap
impl StructuralPartialEq for HeaderMap
Auto Trait Implementations§
impl Freeze for HeaderMap
impl RefUnwindSafe for HeaderMap
impl Send for HeaderMap
impl Sync for HeaderMap
impl Unpin for HeaderMap
impl UnwindSafe for HeaderMap
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