pub struct Commands<'a> { /* private fields */ }Available on crate feature
ecs only.Expand description
A SystemParameter that allows you to create/destroy Entitys, add/remove Components, etc
Implementations§
Source§impl Commands<'_>
impl Commands<'_>
Sourcepub fn create_entity<B>(&mut self, bundle: B)where
B: ComponentBundle,
pub fn create_entity<B>(&mut self, bundle: B)where
B: ComponentBundle,
Creates an Entity
Sourcepub fn destroy_entity(&mut self, entity: Entity)
pub fn destroy_entity(&mut self, entity: Entity)
Sourcepub fn add_components<B>(&mut self, entity: Entity, bundle: B)where
B: ComponentBundle,
pub fn add_components<B>(&mut self, entity: Entity, bundle: B)where
B: ComponentBundle,
Sourcepub fn remove_components<B>(&mut self, entity: Entity)where
B: ComponentBundle,
pub fn remove_components<B>(&mut self, entity: Entity)where
B: ComponentBundle,
Trait Implementations§
Source§impl<'a> SystemParameter for Commands<'a>
impl<'a> SystemParameter for Commands<'a>
Source§type This<'this> = Commands<'this>
type This<'this> = Commands<'this>
The type that this trait is implemented on, but with a different lifetime
Source§type Lock<'state> = &'state Sender<Box<dyn FnOnce(&mut App) + Send>>
type Lock<'state> = &'state Sender<Box<dyn FnOnce(&mut App) + Send>>
The lock returned by
SystemParameter::lockSource§fn lock<'state>(
state: &SystemRunState<'state>,
) -> <Commands<'a> as SystemParameter>::Lock<'state>
fn lock<'state>( state: &SystemRunState<'state>, ) -> <Commands<'a> as SystemParameter>::Lock<'state>
Locks any state required for this
SystemParameterSource§fn construct<'this>(
state: &'this mut <Commands<'a> as SystemParameter>::Lock<'_>,
last_run_tick: u64,
) -> <Commands<'a> as SystemParameter>::This<'this>
fn construct<'this>( state: &'this mut <Commands<'a> as SystemParameter>::Lock<'_>, last_run_tick: u64, ) -> <Commands<'a> as SystemParameter>::This<'this>
Constructs the
SystemParameter from a lockSource§fn get_resource_types() -> impl Iterator<Item = Borrow>
fn get_resource_types() -> impl Iterator<Item = Borrow>
Returns an iterator over all
Resource types that this system parameter will lockSource§fn get_component_types() -> impl Iterator<Item = Borrow>
fn get_component_types() -> impl Iterator<Item = Borrow>
Returns an iterator over all
Component types that this system parameter will lockAuto Trait Implementations§
impl<'a> Freeze for Commands<'a>
impl<'a> RefUnwindSafe for Commands<'a>
impl<'a> Send for Commands<'a>
impl<'a> Sync for Commands<'a>
impl<'a> Unpin for Commands<'a>
impl<'a> UnwindSafe for Commands<'a>
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
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