Struct termite::SparseStorage
source · pub struct SparseStorage { /* private fields */ }
Implementations
sourceimpl SparseStorage
impl SparseStorage
pub fn new(desc: ComponentDescriptor, capacity: usize) -> Self
pub fn check_change_ticks(&mut self, change_tick: u32)
Trait Implementations
sourceimpl Storage for SparseStorage
impl Storage for SparseStorage
fn get(storage: &ComponentStorage) -> &StorageSets<Self>
fn get_mut(storage: &mut ComponentStorage) -> &mut StorageSets<Self>
sourceimpl StorageSet for SparseStorage
impl StorageSet for SparseStorage
sourcefn new(desc: ComponentDescriptor, capacity: usize) -> Self
fn new(desc: ComponentDescriptor, capacity: usize) -> Self
Create a new storage for the given component type
T
.sourcefn contains(&self, entity: Entity) -> bool
fn contains(&self, entity: Entity) -> bool
Returns
true
if the storage contains a component for the given entity.fn entity_ids(&self) -> EntityIdSet
sourceunsafe fn insert(&mut self, entity: Entity, component: *mut u8, change_tick: u32)
unsafe fn insert(&mut self, entity: Entity, component: *mut u8, change_tick: u32)
Inserts a component for the given entity. Read more
sourceunsafe fn remove_unchecked(&mut self, entity: Entity, component: *mut u8)
unsafe fn remove_unchecked(&mut self, entity: Entity, component: *mut u8)
Removes a component for the given entity. Read more
sourcefn remove_and_drop(&mut self, entity: Entity)
fn remove_and_drop(&mut self, entity: Entity)
Removes a component for the given entity.
sourceunsafe fn get_unchecked(&self, entity: Entity) -> *mut u8
unsafe fn get_unchecked(&self, entity: Entity) -> *mut u8
Returns a pointer to the component for the given entity. Read more
sourcefn get(&self, entity: Entity) -> Option<*mut u8>
fn get(&self, entity: Entity) -> Option<*mut u8>
Returns a pointer to the component for the given entity.
sourceunsafe fn get_ticks_unchecked(&self, entity: Entity) -> &UnsafeCell<ChangeTicks>
unsafe fn get_ticks_unchecked(&self, entity: Entity) -> &UnsafeCell<ChangeTicks>
Returns change ticks for the given entity. Read more
sourceunsafe fn get_with_ticks_unchecked(
&self,
entity: Entity
) -> (*mut u8, &UnsafeCell<ChangeTicks>)
unsafe fn get_with_ticks_unchecked(
&self,
entity: Entity
) -> (*mut u8, &UnsafeCell<ChangeTicks>)
Returns a pointer to the component for the given entity and it’s change ticks. Read more
Auto Trait Implementations
impl !RefUnwindSafe for SparseStorage
impl Send for SparseStorage
impl Sync for SparseStorage
impl Unpin for SparseStorage
impl UnwindSafe for SparseStorage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more