pub struct TaggedVec<Index, Value> { /* private fields */ }Expand description
A Vec wrapper that allows indexing only via the given Index type.
For actual operation, Index must implement From<usize> and Into<usize>.
Implementations§
Source§impl<Index, Value> TaggedVec<Index, Value>
impl<Index, Value> TaggedVec<Index, Value>
Sourcepub fn push(&mut self, value: Value) -> Index
pub fn push(&mut self, value: Value) -> Index
Inserts the given value at the back of the TaggedVec, returning its index.
Sourcepub fn pop(&mut self) -> Option<(Index, Value)>
pub fn pop(&mut self) -> Option<(Index, Value)>
Removes the value at the back of the TaggedVec and returns it with its index.
Sourcepub fn iter(&self) -> impl Iterator<Item = (Index, &Value)>
pub fn iter(&self) -> impl Iterator<Item = (Index, &Value)>
Returns an iterator over references to the entries of the TaggedVec.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (Index, &mut Value)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (Index, &mut Value)>
Returns an iterator over mutable references to the entries of the TaggedVec.
Sourcepub fn iter_values(&self) -> Iter<'_, Value>
pub fn iter_values(&self) -> Iter<'_, Value>
Returns an iterator over references to the values of the TaggedVec.
Sourcepub fn iter_values_mut(&mut self) -> IterMut<'_, Value>
pub fn iter_values_mut(&mut self) -> IterMut<'_, Value>
Returns an iterator over mutable references to the values of the TaggedVec.
Sourcepub fn iter_indices(&self) -> impl Iterator<Item = Index>
pub fn iter_indices(&self) -> impl Iterator<Item = Index>
Returns an iterator over the indices of the TaggedVec.
Trait Implementations§
Source§impl<Index, Value> FromIterator<Value> for TaggedVec<Index, Value>
impl<Index, Value> FromIterator<Value> for TaggedVec<Index, Value>
Source§fn from_iter<T: IntoIterator<Item = Value>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Value>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl<'a, Index, Value> IntoIterator for &'a TaggedVec<Index, Value>
impl<'a, Index, Value> IntoIterator for &'a TaggedVec<Index, Value>
Source§impl<'a, Index, Value> IntoIterator for &'a mut TaggedVec<Index, Value>
impl<'a, Index, Value> IntoIterator for &'a mut TaggedVec<Index, Value>
Source§impl<Index, Value> IntoIterator for TaggedVec<Index, Value>
impl<Index, Value> IntoIterator for TaggedVec<Index, Value>
Source§impl<Index, Value: Ord> Ord for TaggedVec<Index, Value>
impl<Index, Value: Ord> Ord for TaggedVec<Index, Value>
Source§impl<Index, Value: PartialOrd> PartialOrd for TaggedVec<Index, Value>
impl<Index, Value: PartialOrd> PartialOrd for TaggedVec<Index, Value>
impl<Index, Value: Eq> Eq for TaggedVec<Index, Value>
Auto Trait Implementations§
impl<Index, Value> Freeze for TaggedVec<Index, Value>
impl<Index, Value> RefUnwindSafe for TaggedVec<Index, Value>where
Index: RefUnwindSafe,
Value: RefUnwindSafe,
impl<Index, Value> Send for TaggedVec<Index, Value>
impl<Index, Value> Sync for TaggedVec<Index, Value>
impl<Index, Value> Unpin for TaggedVec<Index, Value>
impl<Index, Value> UnwindSafe for TaggedVec<Index, Value>where
Index: UnwindSafe,
Value: 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