specs_bundler

Crates.iospecs_bundler
lib.rsspecs_bundler
version0.6.0
sourcesrc
created_at2017-11-18 22:12:33.889339
updated_at2019-07-05 21:39:12.058427
descriptionspecs component and system bundler
homepagehttps://gitlab.com/nathanfaucett/rs-specs_bundler
repositoryhttps://gitlab.com/nathanfaucett/rs-specs_bundler.git
max_upload_size
id39854
size8,428
Nathan Faucett (nathanfaucett)

documentation

README

specs_bundler

specs component and system bundler

specs_bundler = "0.5"
extern crate specs;
extern crate specs_bundler;


use specs::{DispatcherBuilder, World};
use specs_bundler::{Bundler, Bundle};


#[derive(Default)]
struct MyBundle {
    config: bool
}

impl<'world, 'a, 'b> Bundle<'world, 'a, 'b> for MyBundle {
    type Error = ();

    fn build(
        self,
        bundler: Bundler<'world, 'a, 'b>,
    ) -> Result<Bundler<'world, 'a, 'b>, ()> {
        if self.config {
            Ok(bundler)
        } else {
            Err(())
        }
    }
}

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

    let mut dispatcher = Bundler::new(&mut world, DispatcherBuilder::new())
        .bundle(MyBundle { config: true }).expect("should not be an error")
        .build();

    dispatcher.dispatch(&mut world.res);
}
Commit count: 17

cargo fmt