Struct specs::storage::DefaultVecStorage
source · [−]pub struct DefaultVecStorage<T>(_);
Expand description
Vector storage, like VecStorage
, but allows safe access to the
interior slices because unused slots are always initialized.
Requires the component to implement Default
.
as_slice()
and as_mut_slice()
indices correspond to entity IDs.
These can be compared to other DefaultVecStorage
s, to other
VecStorage
s, and to Entity::id()
s for live entities.
Trait Implementations
sourceimpl<T> Default for DefaultVecStorage<T>
impl<T> Default for DefaultVecStorage<T>
sourceimpl<T> UnprotectedStorage<T> for DefaultVecStorage<T> where
T: Default,
impl<T> UnprotectedStorage<T> for DefaultVecStorage<T> where
T: Default,
sourceunsafe fn clean<B>(&mut self, _has: B) where
B: BitSetLike,
unsafe fn clean<B>(&mut self, _has: B) where
B: BitSetLike,
Clean the storage given a bitset with bits set for valid indices. Allows us to safely drop the storage. Read more
sourceunsafe fn get(&self, id: Index) -> &T
unsafe fn get(&self, id: Index) -> &T
Tries reading the data associated with an Index
.
This is unsafe because the external set used
to protect this storage is absent. Read more
sourceunsafe fn get_mut(&mut self, id: Index) -> &mut T
unsafe fn get_mut(&mut self, id: Index) -> &mut T
Tries mutating the data associated with an Index
.
This is unsafe because the external set used
to protect this storage is absent. Read more
impl<T> DistinctStorage for DefaultVecStorage<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for DefaultVecStorage<T> where
T: RefUnwindSafe,
impl<T> Send for DefaultVecStorage<T> where
T: Send,
impl<T> Sync for DefaultVecStorage<T> where
T: Sync,
impl<T> Unpin for DefaultVecStorage<T> where
T: Unpin,
impl<T> UnwindSafe for DefaultVecStorage<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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> Pointable for T
impl<T> Pointable for T
sourceimpl<T> TryDefault for T where
T: Default,
impl<T> TryDefault for T where
T: Default,
sourcefn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
sourcefn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls try_default
and panics on an error case.