Struct salva3d::object::ContiguousArena
source · pub struct ContiguousArena<Idx, T> { /* private fields */ }
Expand description
This is a Vec
behind a generational arena.
The goal of this structure is to have unique identifiers for elements
stored contiguously on a Vec
.
Implementations§
source§impl<Idx, T> ContiguousArena<Idx, T>
impl<Idx, T> ContiguousArena<Idx, T>
sourcepub fn get_from_contiguous_index(&self, index: usize) -> Option<(&T, Idx)>where
Idx: From<ContiguousArenaIndex>,
pub fn get_from_contiguous_index(&self, index: usize) -> Option<(&T, Idx)>where
Idx: From<ContiguousArenaIndex>,
Get an element from its position on the contiguous array.
sourcepub fn get(&self, handle: Idx) -> Option<&T>where
Idx: Into<ContiguousArenaIndex>,
pub fn get(&self, handle: Idx) -> Option<&T>where
Idx: Into<ContiguousArenaIndex>,
Gets a reference to the object identified by handle
.
sourcepub fn get_mut(&mut self, handle: Idx) -> Option<&mut T>where
Idx: Into<ContiguousArenaIndex>,
pub fn get_mut(&mut self, handle: Idx) -> Option<&mut T>where
Idx: Into<ContiguousArenaIndex>,
Gets a mutable reference to the object identified by handle
.
sourcepub fn values_mut(&mut self) -> IterMut<'_, T>
pub fn values_mut(&mut self) -> IterMut<'_, T>
Gets mutable references to all the objects on this set.
sourcepub fn iter<'a>(&'a self) -> impl Iterator<Item = (Idx, &'a T)> + 'awhere
Idx: From<ContiguousArenaIndex>,
pub fn iter<'a>(&'a self) -> impl Iterator<Item = (Idx, &'a T)> + 'awhere
Idx: From<ContiguousArenaIndex>,
Iter through all the objects as well as their handle.
sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Retrieves the set of objects as a mutable slice.
sourcepub fn insert(&mut self, object: T) -> Idxwhere
Idx: From<ContiguousArenaIndex>,
pub fn insert(&mut self, object: T) -> Idxwhere
Idx: From<ContiguousArenaIndex>,
Insert an object into this set.
sourcepub fn remove(&mut self, handle: Idx) -> Option<T>where
Idx: Into<ContiguousArenaIndex>,
pub fn remove(&mut self, handle: Idx) -> Option<T>where
Idx: Into<ContiguousArenaIndex>,
Remove an object from this set.
Trait Implementations§
source§impl<Idx, T> AsMut<[T]> for ContiguousArena<Idx, T>
impl<Idx, T> AsMut<[T]> for ContiguousArena<Idx, T>
source§impl<Idx, T> AsRef<[T]> for ContiguousArena<Idx, T>
impl<Idx, T> AsRef<[T]> for ContiguousArena<Idx, T>
source§impl<Idx: Clone, T: Clone> Clone for ContiguousArena<Idx, T>
impl<Idx: Clone, T: Clone> Clone for ContiguousArena<Idx, T>
source§fn clone(&self) -> ContiguousArena<Idx, T>
fn clone(&self) -> ContiguousArena<Idx, T>
Returns a copy 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<Idx: Into<ContiguousArenaIndex>, T> Index<Idx> for ContiguousArena<Idx, T>
impl<Idx: Into<ContiguousArenaIndex>, T> Index<Idx> for ContiguousArena<Idx, T>
Auto Trait Implementations§
impl<Idx, T> RefUnwindSafe for ContiguousArena<Idx, T>where
Idx: RefUnwindSafe,
T: RefUnwindSafe,
impl<Idx, T> Send for ContiguousArena<Idx, T>
impl<Idx, T> Sync for ContiguousArena<Idx, T>
impl<Idx, T> Unpin for ContiguousArena<Idx, T>
impl<Idx, T> UnwindSafe for ContiguousArena<Idx, T>where
Idx: UnwindSafe,
T: 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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.