pub struct ChunkSparseSet<S> { /* private fields */ }Expand description
Two-dimensional storage containing heterogeneous data types based on
ChunkAnyVec.
Unlike SparseSet, this struct stores data in chunks. Chunk is a fixed
sized memory, and it’s appended when extra capacity is needed. This chunk
based capacity control removes data copy that is seen from normal vector,
but note that it brings inefficiency in terms of iteration.
See SparseSet for more details.
Implementations§
Source§impl<S> ChunkSparseSet<S>where
S: Default,
impl<S> ChunkSparseSet<S>where
S: Default,
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty ChunkSparseSet.
§Examples
let mut cont = ChunkSparseSet::<std::hash::RandomState>::new();Trait Implementations§
Source§impl<S> AddEntity for ChunkSparseSet<S>
impl<S> AddEntity for ChunkSparseSet<S>
Source§fn begin_add_row(&mut self)
fn begin_add_row(&mut self)
Starts inserting component values of an entity to the entity container. Read more
Source§unsafe fn add_value(&mut self, ci: usize, val_ptr: NonNull<u8>)
unsafe fn add_value(&mut self, ci: usize, val_ptr: NonNull<u8>)
Inserts a component value of an entity in the entity container. Read more
Source§unsafe fn end_add_row(&mut self) -> usize
unsafe fn end_add_row(&mut self) -> usize
Finishes inserting component values of an entity in the entity
container then returns row index to the inserted entity. Read more
Source§fn value_ptr_by_value_index(&self, ci: usize, vi: usize) -> Option<NonNull<u8>>
fn value_ptr_by_value_index(&self, ci: usize, vi: usize) -> Option<NonNull<u8>>
Retrieves a pointer to a component value for the given column and value
indices. Read more
Source§fn remove_row(&mut self, ri: usize) -> bool
fn remove_row(&mut self, ri: usize) -> bool
Removes an entity for the given row index from the entity container. Read more
Source§fn remove_row_by_value_index(&mut self, vi: usize)
fn remove_row_by_value_index(&mut self, vi: usize)
Removes an entity for the given value index from the entity container. Read more
Source§unsafe fn begin_remove_row_by_value_index(&mut self, vi: usize)
unsafe fn begin_remove_row_by_value_index(&mut self, vi: usize)
Starts removing component values of an entity from the entity container. Read more
Source§unsafe fn remove_value_by_value_index(
&mut self,
ci: usize,
vi: usize,
buf: NonNull<u8>,
)
unsafe fn remove_value_by_value_index( &mut self, ci: usize, vi: usize, buf: NonNull<u8>, )
Removes a component value of an entity in the entity container then
write it to the given buffer. Read more
Source§unsafe fn drop_value_by_value_index(&mut self, ci: usize, vi: usize)
unsafe fn drop_value_by_value_index(&mut self, ci: usize, vi: usize)
Drops a component value of an entity in the entity container. Read more
Source§unsafe fn forget_value_by_value_index(&mut self, ci: usize, vi: usize)
unsafe fn forget_value_by_value_index(&mut self, ci: usize, vi: usize)
Removes and forgets a component value of an entity in the entity
container. Read more
Source§unsafe fn end_remove_row_by_value_index(&mut self, vi: usize)
unsafe fn end_remove_row_by_value_index(&mut self, vi: usize)
Finishes removing component values of an entity in the entity container. Read more
Source§impl<S> BorrowComponent for ChunkSparseSet<S>
impl<S> BorrowComponent for ChunkSparseSet<S>
Source§fn borrow_column(&self, ci: usize) -> BorrowResult<RawGetter>
fn borrow_column(&self, ci: usize) -> BorrowResult<RawGetter>
Borrows component column for the given column index. Read more
Source§fn borrow_column_mut(&mut self, ci: usize) -> BorrowResult<RawGetter>
fn borrow_column_mut(&mut self, ci: usize) -> BorrowResult<RawGetter>
Borrows component column mutably for the given column index. Read more
Source§impl<S> ContainEntity for ChunkSparseSet<S>
impl<S> ContainEntity for ChunkSparseSet<S>
Source§fn create_twin(&self) -> Box<dyn ContainEntity>
fn create_twin(&self) -> Box<dyn ContainEntity>
Creates a new entity container that has the same component types without
component values. Read more
Source§fn get_item_mut(&mut self, ci: usize, ri: usize) -> Option<NonNull<u8>>
fn get_item_mut(&mut self, ci: usize, ri: usize) -> Option<NonNull<u8>>
Retrieves an entity for the given component column index and row index
from the entity container. Read more
Source§fn reserve(&mut self, additional: usize)
fn reserve(&mut self, additional: usize)
May reserve at least
additional extra capacity. Read moreSource§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
May shrink capacity of the entity container as much as possible. Read more
Source§impl<S: Debug> Debug for ChunkSparseSet<S>
impl<S: Debug> Debug for ChunkSparseSet<S>
Source§impl<S> Default for ChunkSparseSet<S>where
S: Default,
impl<S> Default for ChunkSparseSet<S>where
S: Default,
Source§impl<S> RegisterComponent for ChunkSparseSet<S>
impl<S> RegisterComponent for ChunkSparseSet<S>
Source§fn add_column(&mut self, tinfo: TypeInfo) -> Option<usize>
fn add_column(&mut self, tinfo: TypeInfo) -> Option<usize>
Adds a new column and returns column index.
Source§fn remove_column(&mut self, ci: usize) -> Option<TypeInfo>
fn remove_column(&mut self, ci: usize) -> Option<TypeInfo>
Removes the component column from the entity container. Read more
Source§fn get_column_index(&self, ty: &TypeId) -> Option<usize>
fn get_column_index(&self, ty: &TypeId) -> Option<usize>
Retrieves column index for the given component type. Read more
Source§fn num_columns(&self) -> usize
fn num_columns(&self) -> usize
Retrieves number of component columns in the entity container. Read more
Auto Trait Implementations§
impl<S> Freeze for ChunkSparseSet<S>where
S: Freeze,
impl<S> RefUnwindSafe for ChunkSparseSet<S>where
S: RefUnwindSafe,
impl<S> Send for ChunkSparseSet<S>where
S: Send,
impl<S> Sync for ChunkSparseSet<S>where
S: Sync,
impl<S> Unpin for ChunkSparseSet<S>where
S: Unpin,
impl<S> UnwindSafe for ChunkSparseSet<S>where
S: 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more