10 releases (5 breaking)

Uses old Rust 2015

0.6.0 Jul 5, 2019
0.5.0 Jun 28, 2018
0.4.0 Jun 26, 2018
0.3.2 Jun 26, 2018
0.1.1 Nov 19, 2017

#19 in #specs


Used in 7 crates

MIT license

8KB
160 lines

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);
}

Dependencies

~5MB
~105K SLoC