Struct wasmi_collections::ComponentVec
source · pub struct ComponentVec<Idx, T> { /* private fields */ }
Expand description
Stores components for entities backed by a Vec
.
Implementations§
source§impl<Idx, T> ComponentVec<Idx, T>
impl<Idx, T> ComponentVec<Idx, T>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty ComponentVec
.
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears all components from the ComponentVec
.
source§impl<Idx, T> ComponentVec<Idx, T>where
Idx: ArenaIndex,
impl<Idx, T> ComponentVec<Idx, T>where
Idx: ArenaIndex,
sourcepub fn set(&mut self, index: Idx, component: T) -> Option<T>
pub fn set(&mut self, index: Idx, component: T) -> Option<T>
Sets the component
for the entity at index
.
Returns the old component of the same entity if any.
sourcepub fn unset(&mut self, index: Idx) -> Option<T>
pub fn unset(&mut self, index: Idx) -> Option<T>
Unsets the component for the entity at index
and returns it if any.
Trait Implementations§
source§impl<Idx, T> Debug for ComponentVec<Idx, T>where
T: Debug,
impl<Idx, T> Debug for ComponentVec<Idx, T>where
T: Debug,
source§impl<Idx, T> Default for ComponentVec<Idx, T>
impl<Idx, T> Default for ComponentVec<Idx, T>
source§impl<Idx, T> Index<Idx> for ComponentVec<Idx, T>where
Idx: ArenaIndex,
impl<Idx, T> Index<Idx> for ComponentVec<Idx, T>where
Idx: ArenaIndex,
source§impl<Idx, T> IndexMut<Idx> for ComponentVec<Idx, T>where
Idx: ArenaIndex,
impl<Idx, T> IndexMut<Idx> for ComponentVec<Idx, T>where
Idx: ArenaIndex,
source§impl<Idx, T> PartialEq for ComponentVec<Idx, T>where
T: PartialEq,
impl<Idx, T> PartialEq for ComponentVec<Idx, T>where
T: PartialEq,
impl<Idx, T> Eq for ComponentVec<Idx, T>where
T: Eq,
impl<Idx, T> Send for ComponentVec<Idx, T>where
T: Send,
ComponentVec
does not store Idx
therefore it is Send
without its bound.
impl<Idx, T> Sync for ComponentVec<Idx, T>where
T: Sync,
ComponentVec
does not store Idx
therefore it is Sync
without its bound.
Auto Trait Implementations§
impl<Idx, T> Freeze for ComponentVec<Idx, T>
impl<Idx, T> RefUnwindSafe for ComponentVec<Idx, T>where
T: RefUnwindSafe,
impl<Idx, T> Unpin for ComponentVec<Idx, T>where
T: Unpin,
impl<Idx, T> UnwindSafe for ComponentVec<Idx, 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