pub struct LazyComponents(/* private fields */);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§
Source§impl LazyComponents
impl LazyComponents
Sourcepub fn insert_bundle<B: IsBundle + Send + Sync + 'static>(
&mut self,
entity_id: usize,
bundle: B,
)
pub fn insert_bundle<B: IsBundle + Send + Sync + '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.
Sourcepub fn apply(self, components: &mut Components)
pub fn apply(self, components: &mut Components)
Trait Implementations§
Source§impl Default for LazyComponents
impl Default for LazyComponents
Source§fn default() -> LazyComponents
fn default() -> LazyComponents
Returns the “default value” for a type. Read more
Source§impl Extend<Box<dyn FnOnce(&mut Components) + Sync + Send>> for LazyComponents
impl Extend<Box<dyn FnOnce(&mut Components) + Sync + Send>> for LazyComponents
Source§fn extend<T: IntoIterator<Item = Box<dyn FnOnce(&mut Components) + Send + Sync + 'static>>>(
&mut self,
iter: T,
)
fn extend<T: IntoIterator<Item = Box<dyn FnOnce(&mut Components) + Send + Sync + 'static>>>( &mut self, iter: T, )
Extends a collection with the contents of an iterator. Read more
§fn 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.
§fn 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
Source§impl IntoIterator for LazyComponents
impl IntoIterator for LazyComponents
Source§type Item = Box<dyn FnOnce(&mut Components) + Sync + Send>
type Item = Box<dyn FnOnce(&mut Components) + Sync + Send>
The type of the elements being iterated over.
Source§type IntoIter = IntoIter<<LazyComponents as IntoIterator>::Item>
type IntoIter = IntoIter<<LazyComponents as IntoIterator>::Item>
Which kind of iterator are we turning this into?
Auto Trait Implementations§
impl Freeze for LazyComponents
impl !RefUnwindSafe for LazyComponents
impl Send for LazyComponents
impl Sync for LazyComponents
impl Unpin for LazyComponents
impl !UnwindSafe for LazyComponents
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more