Enum Entry
pub enum Entry<'a, T>where
T: 'a,{
Occupied(OccupiedEntry<'a, T>),
Vacant(VacantEntry<'a, T>),
}
Expand description
A view into a single location in a HeaderMap
, which may be vacant or occupied.
Variants§
Implementations§
§impl<'a, T> Entry<'a, T>
impl<'a, T> Entry<'a, T>
pub fn or_insert(self, default: T) -> &'a mut T
pub fn or_insert(self, default: T) -> &'a mut T
Ensures a value is in the entry by inserting the default if empty.
Returns a mutable reference to the first value in the entry.
§Panics
This method panics if capacity exceeds max HeaderMap
capacity
§Examples
let mut map: HeaderMap<u32> = HeaderMap::default();
let headers = &[
"content-length",
"x-hello",
"Content-Length",