Enum Entry
pub enum Entry<'a> {
Vacant(VacantEntry<'a>),
Occupied(OccupiedEntry<'a>),
}Expand description
A view into the storage for a particular header name
Variants§
Vacant(VacantEntry<'a>)
A mutable view into the location that header values would be inserted into this
Headers for the specified HeaderName
Occupied(OccupiedEntry<'a>)
A mutable view into the header values are stored for the specified HeaderName
Implementations§
§impl<'a> Entry<'a>
impl<'a> Entry<'a>
pub fn name(&self) -> HeaderName<'_>
pub fn name(&self) -> HeaderName<'_>
retrieve the HeaderName for this entry.
pub fn insert(self, values: impl Into<HeaderValues>) -> &'a mut HeaderValues
pub fn insert(self, values: impl Into<HeaderValues>) -> &'a mut HeaderValues
Sets the value of the entry, and returns a mutable reference to the inserted value.
Note that this drops any previous occupied value.
pub fn append(self, values: impl Into<HeaderValues>) -> &'a mut HeaderValues
pub fn append(self, values: impl Into<HeaderValues>) -> &'a mut HeaderValues
Sets the value of the entry if it is vacant, and appends the new header values to the previous ones if occupied. Returns a mutable reference to the inserted or updated value.
pub fn or_insert_with<V>(
self,
values: impl FnOnce() -> V,
) -> &'a mut HeaderValueswhere
V: Into<HeaderValues>,
pub fn or_insert_with<V>(
self,
values: impl FnOnce() -> V,
) -> &'a mut HeaderValueswhere
V: Into<HeaderValues>,
Sets the value if previously vacant. The provided function is only executed if the entry is vacant.
pub fn or_insert(self, values: impl Into<HeaderValues>) -> &'a mut HeaderValues
pub fn or_insert(self, values: impl Into<HeaderValues>) -> &'a mut HeaderValues
Sets the value if previously vacant. See also Entry::or_insert_with if constructing the
default value is expensive.
pub fn and_modify(self, f: impl FnOnce(&mut HeaderValues)) -> Entry<'a>
pub fn and_modify(self, f: impl FnOnce(&mut HeaderValues)) -> Entry<'a>
Provides in-place mutable access to an occupied entry before any
potential inserts with Entry::or_insert or Entry::or_insert_with.
pub fn is_occupied(&self) -> bool
pub fn is_occupied(&self) -> bool
Predicate to determine if this is an OccupiedEntry