#specs #bundler

specs_bundler

specs component and system bundler

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

#3 in #specs

Download history 39/week @ 2023-11-04 59/week @ 2023-11-11 35/week @ 2023-11-18 61/week @ 2023-11-25 46/week @ 2023-12-02 30/week @ 2023-12-09 43/week @ 2023-12-16 53/week @ 2023-12-23 18/week @ 2023-12-30 32/week @ 2024-01-06 39/week @ 2024-01-13 34/week @ 2024-01-20 38/week @ 2024-01-27 25/week @ 2024-02-03 55/week @ 2024-02-10 225/week @ 2024-02-17

350 downloads per month
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
~99K SLoC