pub struct TupleMap<K: PartialEq, V>(/* private fields */);Expand description
Key-Value map to handle a few entires.
Usually, a web app handles 0 ~ 4 custom headers, and so
simple Vec<(K, V)> is efficient than HashMap<K, V>
to store/iterate/mutate.
Implementations§
Source§impl<K: PartialEq, V> TupleMap<K, V>
impl<K: PartialEq, V> TupleMap<K, V>
pub fn new() -> Self
pub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn remove(&mut self, key: K) -> Option<V>
pub fn append(&mut self, another: Self)
pub fn clear(&mut self)
pub fn iter(&self) -> impl Iterator<Item = &(K, V)>
pub fn keys(&self) -> impl Iterator<Item = &K>
pub fn values(&self) -> impl Iterator<Item = &V>
Trait Implementations§
Source§impl<'de, K, V> Deserialize<'de> for TupleMap<K, V>
impl<'de, K, V> Deserialize<'de> for TupleMap<K, V>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl<K: PartialEq, V> IntoIterator for TupleMap<K, V>
impl<K: PartialEq, V> IntoIterator for TupleMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for TupleMap<K, V>
impl<K, V> RefUnwindSafe for TupleMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for TupleMap<K, V>
impl<K, V> Sync for TupleMap<K, V>
impl<K, V> Unpin for TupleMap<K, V>
impl<K, V> UnwindSafe for TupleMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
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