pub struct Commands<'a> { /* private fields */ }Implementations§
Source§impl<'a> Commands<'a>
impl<'a> Commands<'a>
Sourcepub fn reserve_entities(&mut self, additional: u32)
pub fn reserve_entities(&mut self, additional: u32)
Reserve storage for additional number of additional entities.
Reserve happens lazily, this can be used in conjunction with spawn but not with id()
fn sys(mut cmd: Commands) {
cmd.reserve_entities(128);
for i in 0..128 {
// this is fine
cmd.spawn().insert(i);
}
}ⓘ
fn sys(mut cmd: Commands) {
cmd.reserve_entities(128);
for i in 0..128 {
// id will return an error, since the reserve has not happened yet
cmd.spawn().id().unwrap();
}
}pub fn entity(&mut self, id: EntityId) -> &mut EntityCommands
Sourcepub fn insert_id(&mut self, id: EntityId) -> &mut EntityCommands
pub fn insert_id(&mut self, id: EntityId) -> &mut EntityCommands
Take a pre-made id and insert into the world Will cause an error if the id slot is taken
pub fn spawn(&mut self) -> &mut EntityCommands
pub fn delete(&mut self, id: EntityId)
pub fn insert_resource<T: Component>(&mut self, resource: T)
pub fn remove_resource<T: Component>(&mut self)
pub fn merge_entities(&mut self, src: EntityId, dst: EntityId)
Trait Implementations§
impl<'a> Send for Commands<'a>
impl<'a> Sync for Commands<'a>
Source§impl<'a> WorldQuery<'a> for Commands<'a>
impl<'a> WorldQuery<'a> for Commands<'a>
fn new(w: &'a World, system_idx: usize) -> Self
Source§fn resources_mut(set: &mut HashSet<TypeId>)
fn resources_mut(set: &mut HashSet<TypeId>)
List of resource types this query needs exclusive access to
Source§fn components_mut(_set: &mut HashSet<TypeId>)
fn components_mut(_set: &mut HashSet<TypeId>)
List of component types this query needs exclusive access to
Source§fn components_const(_set: &mut HashSet<TypeId>)
fn components_const(_set: &mut HashSet<TypeId>)
List of component types this query needs
Source§fn resources_const(_set: &mut HashSet<TypeId>)
fn resources_const(_set: &mut HashSet<TypeId>)
List of resource types this query needs
fn read_only() -> bool
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Commands<'a>
impl<'a> !UnwindSafe for Commands<'a>
impl<'a> Freeze for Commands<'a>
impl<'a> Unpin for Commands<'a>
impl<'a> UnsafeUnpin 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