pub trait ParentCommands<'w, 's, 'a> {
// Required methods
fn root_id(&self) -> Entity;
fn id(&self) -> Entity;
fn commands(&mut self) -> &mut Commands<'w, 's>;
// Provided methods
fn insert(&mut self, component: impl Component) -> &mut Self { ... }
fn insert_bundle(&mut self, bundle: impl Bundle) -> &mut Self { ... }
fn with_child<T>(&mut self, bundle: T) -> ChildCommands<'w, 's, '_>
where T: Bundle { ... }
fn with_empty_child<T>(&mut self) -> ChildCommands<'w, 's, '_> { ... }
fn with_descendants(
&mut self,
local_root: impl FnOnce(&mut RootCommands<'_, '_, '_>),
) -> &mut Self { ... }
fn add_child(&mut self, child: Entity) -> &mut Self { ... }
fn with_child_batch<I>(&mut self, bundles_iter: I) -> &mut Self
where I: IntoIterator + Send + Sync + 'static,
I::Item: Bundle { ... }
}Required Methods§
Provided Methods§
Sourcefn insert(&mut self, component: impl Component) -> &mut Self
fn insert(&mut self, component: impl Component) -> &mut Self
add a component to the current entity
Sourcefn insert_bundle(&mut self, bundle: impl Bundle) -> &mut Self
fn insert_bundle(&mut self, bundle: impl Bundle) -> &mut Self
add a bundle of components to the current entity
Sourcefn with_child<T>(&mut self, bundle: T) -> ChildCommands<'w, 's, '_>where
T: Bundle,
fn with_child<T>(&mut self, bundle: T) -> ChildCommands<'w, 's, '_>where
T: Bundle,
Create a child entity with components from bundle with the current entity as its parent. Then make it the current entity
Sourcefn with_empty_child<T>(&mut self) -> ChildCommands<'w, 's, '_>
fn with_empty_child<T>(&mut self) -> ChildCommands<'w, 's, '_>
create a child entity and make it the current entity
Sourcefn with_descendants(
&mut self,
local_root: impl FnOnce(&mut RootCommands<'_, '_, '_>),
) -> &mut Self
fn with_descendants( &mut self, local_root: impl FnOnce(&mut RootCommands<'_, '_, '_>), ) -> &mut Self
makes the current entity the root of a new local hierachy
Sourcefn add_child(&mut self, child: Entity) -> &mut Self
fn add_child(&mut self, child: Entity) -> &mut Self
create a child entity but don’t advance to it.
Sourcefn with_child_batch<I>(&mut self, bundles_iter: I) -> &mut Self
fn with_child_batch<I>(&mut self, bundles_iter: I) -> &mut Self
create multiple children each spawned with the same bundle of components.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.