pub struct PrimaryMap<K, V>where
K: EntityRef,{ /* private fields */ }Expand description
Like cranelift_entity::PrimaryMap but enforces fallible allocation for
all methods that allocate.
Implementations§
Source§impl<K, V> PrimaryMap<K, V>where
K: EntityRef,
impl<K, V> PrimaryMap<K, V>where
K: EntityRef,
Sourcepub fn new() -> Self
pub fn new() -> Self
Same as cranelift_entity::PrimaryMap::new.
Sourcepub fn with_capacity(capacity: usize) -> Result<Self, OutOfMemory>
pub fn with_capacity(capacity: usize) -> Result<Self, OutOfMemory>
Sourcepub fn get(&self, k: K) -> Option<&V>
pub fn get(&self, k: K) -> Option<&V>
Same as cranelift_entity::PrimaryMap::get.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Same as cranelift_entity::PrimaryMap::len.
Sourcepub fn keys(&self) -> Keys<K> ⓘ
pub fn keys(&self) -> Keys<K> ⓘ
Same as cranelift_entity::PrimaryMap::keys.
Sourcepub fn values(&self) -> Iter<'_, V> ⓘ
pub fn values(&self) -> Iter<'_, V> ⓘ
Same as cranelift_entity::PrimaryMap::values.
Sourcepub fn values_mut(&mut self) -> IterMut<'_, V> ⓘ
pub fn values_mut(&mut self) -> IterMut<'_, V> ⓘ
Sourcepub fn as_values_slice(&self) -> &[V]
pub fn as_values_slice(&self) -> &[V]
Sourcepub fn iter(&self) -> Iter<'_, K, V> ⓘ
pub fn iter(&self) -> Iter<'_, K, V> ⓘ
Same as cranelift_entity::PrimaryMap::iter.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Same as cranelift_entity::PrimaryMap::clear.
Sourcepub fn push(&mut self, v: V) -> Result<K, OutOfMemory>
pub fn push(&mut self, v: V) -> Result<K, OutOfMemory>
Same as cranelift_entity::PrimaryMap::push but returns an error on
allocation failure.
Sourcepub fn last(&self) -> Option<(K, &V)>
pub fn last(&self) -> Option<(K, &V)>
Same as cranelift_entity::PrimaryMap::last.
Sourcepub fn reserve_exact(&mut self, additional: usize) -> Result<(), OutOfMemory>
pub fn reserve_exact(&mut self, additional: usize) -> Result<(), OutOfMemory>
Sourcepub fn get_disjoint_mut<const N: usize>(
&mut self,
indices: [K; N],
) -> Result<[&mut V; N], GetDisjointMutError>
pub fn get_disjoint_mut<const N: usize>( &mut self, indices: [K; N], ) -> Result<[&mut V; N], GetDisjointMutError>
Sourcepub fn binary_search_values_by_key<'a, B, F>(
&'a self,
b: &B,
f: F,
) -> Result<K, K>
pub fn binary_search_values_by_key<'a, B, F>( &'a self, b: &B, f: F, ) -> Result<K, K>
Sourcepub fn get_raw_mut(&mut self, k: K) -> Option<*mut V>
pub fn get_raw_mut(&mut self, k: K) -> Option<*mut V>
Trait Implementations§
Source§impl<K, V: Clone> Clone for PrimaryMap<K, V>
impl<K, V: Clone> Clone for PrimaryMap<K, V>
Source§fn clone(&self) -> PrimaryMap<K, V>
fn clone(&self) -> PrimaryMap<K, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<K, V> Debug for PrimaryMap<K, V>
impl<K, V> Debug for PrimaryMap<K, V>
Source§impl<K, V> Default for PrimaryMap<K, V>where
K: EntityRef,
impl<K, V> Default for PrimaryMap<K, V>where
K: EntityRef,
Source§impl<K, V: Hash> Hash for PrimaryMap<K, V>
impl<K, V: Hash> Hash for PrimaryMap<K, V>
Source§impl<K, V> Index<K> for PrimaryMap<K, V>where
K: EntityRef,
impl<K, V> Index<K> for PrimaryMap<K, V>where
K: EntityRef,
Source§impl<K, V> IndexMut<K> for PrimaryMap<K, V>where
K: EntityRef,
impl<K, V> IndexMut<K> for PrimaryMap<K, V>where
K: EntityRef,
Source§impl<K, V: PartialEq> PartialEq for PrimaryMap<K, V>
impl<K, V: PartialEq> PartialEq for PrimaryMap<K, V>
impl<K, V: Eq> Eq for PrimaryMap<K, V>
impl<K, V> StructuralPartialEq for PrimaryMap<K, V>where
K: EntityRef,
Auto Trait Implementations§
impl<K, V> Freeze for PrimaryMap<K, V>
impl<K, V> RefUnwindSafe for PrimaryMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for PrimaryMap<K, V>
impl<K, V> Sync for PrimaryMap<K, V>
impl<K, V> Unpin for PrimaryMap<K, V>
impl<K, V> UnwindSafe for PrimaryMap<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.