Bundle

Trait Bundle 

Source
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§

Source

fn systems() -> Vec<System>

Returns all the systems of this bundle. This should normally be the only function you need to implement.

Provided Methods§

Source

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.

Implementors§

Source§

impl<S, E, I, K, ST, U> Bundle for GameFeaturesSystemBundle<S, E, I, K, ST, U>
where S: Eq + Hash + Send + Sync + 'static + Clone, E: Eq + Hash + Send + Sync + 'static + Clone, I: Eq + Hash + Send + Sync + 'static + Clone + Debug, K: Eq + Hash + Send + Sync + 'static + Debug, ST: Eq + Hash + Send + Sync + 'static + SlotType, U: Eq + Hash + Send + Sync + 'static + Clone + Debug + Default,