pub struct FixedMap<K: IndexableKey, V> {
inner: Vec<Option<V>>,
key_type: PhantomData<K>,
}
Expand description
A drop-in replacement for BTreeMap
, where the keys have the property of being array indices.
Some values may be missing. Much more efficient at operations on individual objects, because
it just becomes a simple array lookup.
Fields§
§inner: Vec<Option<V>>
§key_type: PhantomData<K>
Implementations§
source§impl<K: IndexableKey, V> FixedMap<K, V>
impl<K: IndexableKey, V> FixedMap<K, V>
pub fn new() -> FixedMap<K, V>
pub fn insert(&mut self, key: K, value: V)
pub fn get(&self, key: &K) -> Option<&V>
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
pub fn contains_key(&self, key: &K) -> bool
pub fn remove(&mut self, key: &K) -> Option<V>
pub fn values(&self) -> Flatten<Iter<'_, Option<V>>>
Trait Implementations§
source§impl<K: IndexableKey, V> Default for FixedMap<K, V>
impl<K: IndexableKey, V> Default for FixedMap<K, V>
source§impl<'de, K: IndexableKey, V> Deserialize<'de> for FixedMap<K, V>where
V: Deserialize<'de>,
impl<'de, K: IndexableKey, V> Deserialize<'de> for FixedMap<K, V>where
V: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<K, V> Freeze for FixedMap<K, V>
impl<K, V> RefUnwindSafe for FixedMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for FixedMap<K, V>
impl<K, V> Sync for FixedMap<K, V>
impl<K, V> Unpin for FixedMap<K, V>
impl<K, V> UnwindSafe for FixedMap<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