pub struct NiTMap<K, V> {
pub __base: NiTMapBase<K, V, NiTDefaultAllocator<NiTMapItem<K, V>>>,
}
Expand description
A generic map data structure that supports basic operations like insertion, removal, and lookup.
This type is designed to be compatible with C++’s NiTMap
and is exposed through FFI bindings.
§Note
As far as the requirements in the vtable are concerned, key is supposed to be a Copy
type.
Fields§
§__base: NiTMapBase<K, V, NiTDefaultAllocator<NiTMapItem<K, V>>>
Implementations§
Source§impl<K, V> NiTMap<K, V>
impl<K, V> NiTMap<K, V>
Source§impl<K, V> NiTMap<K, V>where
K: Copy,
impl<K, V> NiTMap<K, V>where
K: Copy,
Sourcepub fn get(&self, key: &K) -> Option<&V>
pub fn get(&self, key: &K) -> Option<&V>
Gets a reference to the value associated with the given key.
Sourcepub fn get_mut(&mut self, key: &K) -> Option<&mut V>
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
Gets a mutable reference to the value associated with the given key.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Checks if the map contains the specified key.
Sourcepub fn insert(&mut self, key: K, value: V) -> bool
pub fn insert(&mut self, key: K, value: V) -> bool
Inserts a new key-value pair into the map.
If the key already exists in the map, this will replace the existing value.
Sourcepub fn remove(&mut self, key: &K) -> Option<V>
pub fn remove(&mut self, key: &K) -> Option<V>
Removes the key-value pair associated with the given key.
Sourcepub const fn iter(&self) -> NiTMapIter<'_, K, V> ⓘ
pub const fn iter(&self) -> NiTMapIter<'_, K, V> ⓘ
Returns an iterator over the map’s key-value pairs.
Trait Implementations§
Source§impl<K: Copy, V> Extend<(K, V)> for NiTMap<K, V>
impl<K: Copy, V> Extend<(K, V)> for NiTMap<K, V>
Source§fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a, K, V> IntoIterator for &'a NiTMap<K, V>
impl<'a, K, V> IntoIterator for &'a NiTMap<K, V>
Source§impl<K, V> IntoIterator for NiTMap<K, V>where
K: Copy,
impl<K, V> IntoIterator for NiTMap<K, V>where
K: Copy,
Source§impl<K, V> Ord for NiTMap<K, V>
impl<K, V> Ord for NiTMap<K, V>
Source§impl<K, V> PartialOrd for NiTMap<K, V>
impl<K, V> PartialOrd for NiTMap<K, V>
impl<K, V> Eq for NiTMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for NiTMap<K, V>
impl<K, V> RefUnwindSafe for NiTMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> !Send for NiTMap<K, V>
impl<K, V> !Sync for NiTMap<K, V>
impl<K, V> Unpin for NiTMap<K, V>
impl<K, V> UnwindSafe for NiTMap<K, V>
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