pub struct VecStorage<T>(/* private fields */);
Expand description
Vector storage. Uses a simple Vec
. Supposed to have maximum
performance for the components mostly present in entities.
as_slice()
and as_mut_slice()
indices correspond to
entity IDs. These can be compared to other VecStorage
s, to
other DefaultVecStorage
s, and to Entity::id()
s for live
entities.
Trait Implementations§
Source§impl<T> Default for VecStorage<T>
impl<T> Default for VecStorage<T>
Source§impl<T> Storage<T> for VecStorage<T>
impl<T> Storage<T> for VecStorage<T>
Source§unsafe fn get(&self, index: Index) -> &T
unsafe fn get(&self, index: 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 moreSource§unsafe fn get_mut(&mut self, index: Index) -> &mut T
unsafe fn get_mut(&mut self, index: 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 moreSource§unsafe fn insert(&mut self, index: Index, value: T)
unsafe fn insert(&mut self, index: Index, value: T)
Inserts new data for a given
Index
. Read moreSource§unsafe fn remove(&mut self, index: Index) -> T
unsafe fn remove(&mut self, index: Index) -> T
Removes the data associated with an
Index
. Read moreSource§unsafe 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
impl<T> DistinctStorage for VecStorage<T>
Auto Trait Implementations§
impl<T> Freeze for VecStorage<T>
impl<T> RefUnwindSafe for VecStorage<T>where
T: RefUnwindSafe,
impl<T> Send for VecStorage<T>where
T: Send,
impl<T> Sync for VecStorage<T>where
T: Sync,
impl<T> Unpin for VecStorage<T>where
T: Unpin,
impl<T> UnwindSafe for VecStorage<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