kvarn_utils::prelude::header

Struct OccupiedEntry

pub struct OccupiedEntry<'a, T> { /* private fields */ }
Expand description

A view into a single occupied location in a HeaderMap.

This struct is returned as part of the Entry enum.

Implementations§

§

impl<'a, T> OccupiedEntry<'a, T>

pub fn key(&self) -> &HeaderName

Returns a reference to the entry’s key.

§Examples
let mut map = HeaderMap::new();
map.insert(HOST, "world".parse().unwrap());

if let Entry::Occupied(e) = map.entry("host") {
    assert_eq!("host", e.key());
}

pub fn get(&self) -> &T

Get a reference to the first value in the entry.

Values are stored in insertion order.

§Panics

get panics if there are no values associated with the entry.