pub trait Bundle {
// Required method
fn systems() -> Vec<System>;
// Provided method
fn insert(builder: DispatcherBuilder) -> DispatcherBuilder { ... }
}Expand description
A trait allowing the creation of bundles.
Bundles are groups of Systems that are added together and
in order in a DispatcherBuilder.
§Example
use world_dispatcher::*;
use planck_ecs_bundle::*;
struct TestBundle;
impl Bundle for TestBundle {
fn systems() -> Vec<System> {
vec![
(|| {Ok(())}).system(),
(|| {Ok(())}).system(),
(|| {println!("hello!"); Ok(())}).system(),
]
}
}
let mut builder = DispatcherBuilder::default();
#[allow(unused_assignments)]
{
builder = TestBundle::insert(builder);
}Required Methods§
Provided Methods§
Sourcefn insert(builder: DispatcherBuilder) -> DispatcherBuilder
fn insert(builder: DispatcherBuilder) -> DispatcherBuilder
Inserts the systems of this bundle into the provided DispatcherBuilder.
A default implementation is already provided for you.
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.