pub struct SoftVec<T>(/* private fields */);
Expand description
Soft version of a Vec with Generational scheme
Similar to the LightVec, the SoftVec is a data structure with a so-called Generational scheme, that functions as a versioning scheme for indices. In contrast to LightVec, there isn’t an implemented allocator for the SoftVec. Instead, there is a trait that must be implemented in order to provide the Generational indices.
Implementations§
Source§impl<T> SoftVec<T>
impl<T> SoftVec<T>
Sourcepub fn with_capacity(capacity: usize) -> SoftVec<T>
pub fn with_capacity(capacity: usize) -> SoftVec<T>
Creates a new SoftVec
Creates a new SoftVec, with the given capacity, in order to reduce initial allocations
Sourcepub fn get(
&self,
index: &GenerationalIndex,
alloc: &mut impl SoftAlloc,
) -> Option<&T>
pub fn get( &self, index: &GenerationalIndex, alloc: &mut impl SoftAlloc, ) -> Option<&T>
Returns a value with the given index
Sourcepub fn insert(
&mut self,
value: T,
alloc: &mut impl SoftAlloc,
) -> GenerationalIndex
pub fn insert( &mut self, value: T, alloc: &mut impl SoftAlloc, ) -> GenerationalIndex
Inserts a value on the vector
Auto Trait Implementations§
impl<T> Freeze for SoftVec<T>
impl<T> RefUnwindSafe for SoftVec<T>where
T: RefUnwindSafe,
impl<T> Send for SoftVec<T>where
T: Send,
impl<T> Sync for SoftVec<T>where
T: Sync,
impl<T> Unpin for SoftVec<T>where
T: Unpin,
impl<T> UnwindSafe for SoftVec<T>where
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