Struct apecs::LazyComponents
source · [−]pub struct LazyComponents(_);Expand description
Add components lazily, at the time of your choosing.
Used in instances where you can’t apply changes to Components because of a borrow conflict (eg while iterating over a component query).
Implementations
sourceimpl LazyComponents
impl LazyComponents
sourcepub fn insert_bundle<B: IsBundle + 'static>(
&mut self,
entity_id: usize,
bundle: B
)
pub fn insert_bundle<B: IsBundle + 'static>(
&mut self,
entity_id: usize,
bundle: B
)
Inserts the bundled components for the given entity.
sourcepub fn insert_component<T: Send + Sync + 'static>(
&mut self,
entity_id: usize,
component: T
)
pub fn insert_component<T: Send + Sync + 'static>(
&mut self,
entity_id: usize,
component: T
)
Insert a single component for the given entity.
sourcepub fn remove<B: IsBundle + 'static>(&mut self, entity_id: usize)
pub fn remove<B: IsBundle + 'static>(&mut self, entity_id: usize)
Remove all components of the given entity and return them as a typed bundle.
sourcepub fn remove_component<T: Send + Sync + 'static>(&mut self, entity_id: usize)
pub fn remove_component<T: Send + Sync + 'static>(&mut self, entity_id: usize)
Remove a single component from the given entity, returning it if the entity had a component of that type.
sourcepub fn apply(self, components: &mut Components)
pub fn apply(self, components: &mut Components)
Trait Implementations
sourceimpl Default for LazyComponents
impl Default for LazyComponents
sourcefn default() -> LazyComponents
fn default() -> LazyComponents
Returns the “default value” for a type. Read more
sourceimpl Extend<Box<dyn FnOnce(&mut Components) + 'static, Global>> for LazyComponents
impl Extend<Box<dyn FnOnce(&mut Components) + 'static, Global>> for LazyComponents
sourcefn extend<T: IntoIterator<Item = Box<dyn FnOnce(&mut Components)>>>(
&mut self,
iter: T
)
fn extend<T: IntoIterator<Item = Box<dyn FnOnce(&mut Components)>>>(
&mut self,
iter: T
)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl IntoIterator for LazyComponents
impl IntoIterator for LazyComponents
type Item = Box<dyn FnOnce(&mut Components) + 'static, Global>
type Item = Box<dyn FnOnce(&mut Components) + 'static, Global>
The type of the elements being iterated over.
type IntoIter = IntoIter<<LazyComponents as IntoIterator>::Item, Global>
type IntoIter = IntoIter<<LazyComponents as IntoIterator>::Item, Global>
Which kind of iterator are we turning this into?
Auto Trait Implementations
impl !RefUnwindSafe for LazyComponents
impl !Send for LazyComponents
impl !Sync for LazyComponents
impl Unpin for LazyComponents
impl !UnwindSafe for LazyComponents
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