pub struct UniValMap<V> {
data: Vec<Option<V>>,
}
Expand description
From UniIndex to V
Fields§
§data: Vec<Option<V>>
The mapping data. Thanks to Vec we get both fast accesses, and a memory-optimal representation if there are few deletions.
Implementations§
Source§impl<V: PartialEq> UniValMap<V>
impl<V: PartialEq> UniValMap<V>
Sourcepub fn identical(&self, other: &Self) -> bool
pub fn identical(&self, other: &Self) -> bool
Exact equality of two maps.
Less accurate but faster than equivalent
, mostly because
of the fast path when the lengths are different.
Sourcepub fn equivalent(&self, other: &Self) -> bool
pub fn equivalent(&self, other: &Self) -> bool
Equality up to trailing None
s of two maps, i.e.
do they represent the same mapping ?
Source§impl<V> UniValMap<V>
impl<V> UniValMap<V>
Sourcepub fn contains_idx(&self, idx: UniIndex) -> bool
pub fn contains_idx(&self, idx: UniIndex) -> bool
Whether this index has an associated value.
Sourcefn extend_to_length(&mut self, len: usize)
fn extend_to_length(&mut self, len: usize)
Reserve enough space to insert the value at the right index.
Sourcepub fn insert(&mut self, idx: UniIndex, val: V)
pub fn insert(&mut self, idx: UniIndex, val: V)
Assign a value to the index. Permanently overwrites any previous value.
Trait Implementations§
Source§impl<V: PartialEq> PartialEq for UniValMap<V>
impl<V: PartialEq> PartialEq for UniValMap<V>
impl<V: Eq> Eq for UniValMap<V>
Auto Trait Implementations§
impl<V> Freeze for UniValMap<V>
impl<V> RefUnwindSafe for UniValMap<V>where
V: RefUnwindSafe,
impl<V> Send for UniValMap<V>where
V: Send,
impl<V> Sync for UniValMap<V>where
V: Sync,
impl<V> Unpin for UniValMap<V>where
V: Unpin,
impl<V> UnwindSafe for UniValMap<V>where
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes