specs_bundler 0.1.0

specs component and system bundler
Documentation

specs_bundler

specs component and system bundler

specs_bundler = "0.1"
extern crate specs;
extern crate specs_bundler;


use specs::{DispatcherBuilder, World};
use specs_bundler::{SpecsBundler, SpecsBundle};


struct Bundle;

impl<'a, 'b> SpecsBundle<'a, 'b> for Bundle {
    type Args = ();

    fn build(
        _world: &mut World,
        dispatcher_builder: DispatcherBuilder<'a, 'b>,
        _args: Self::Args
    ) -> specs_bundler::Result<DispatcherBuilder<'a, 'b>> {
        Ok(dispatcher_builder)
    }
}

fn main() {
    let mut world = World::new();

    let mut dispatcher = SpecsBundler::new(&mut world, DispatcherBuilder::new())
        .bundle::<Bundle>(()).expect("should not be an error")
        .build();

    dispatcher.dispatch(&mut world.res);
}