WithChildren

Trait WithChildren 

Source
pub trait WithChildren: Bundle + Sized {
    // Required method
    fn with_children(
        self,
        f: impl FnOnce(&mut SpawnChildBuilder<'_>),
    ) -> (Self, SpawnChildren);
}
👎Deprecated since 0.2.4: see documentation at https://github.com/Zeenobit/moonshine_spawn for details
Expand description

Trait used to attach children to an Entity using a Bundle.

§Example


#[derive(Component)]
struct Foo;

#[derive(Component)]
struct Bar;

let mut world = World::default();
world.spawn(Foo.with_children(|foo| {
   foo.spawn(Bar);
}));

Required Methods§

Source

fn with_children( self, f: impl FnOnce(&mut SpawnChildBuilder<'_>), ) -> (Self, SpawnChildren)

👎Deprecated since 0.2.4: see documentation at https://github.com/Zeenobit/moonshine_spawn for details

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.

Implementors§