Crates.io | specs_bundler |
lib.rs | specs_bundler |
version | 0.6.0 |
source | src |
created_at | 2017-11-18 22:12:33.889339 |
updated_at | 2019-07-05 21:39:12.058427 |
description | specs component and system bundler |
homepage | https://gitlab.com/nathanfaucett/rs-specs_bundler |
repository | https://gitlab.com/nathanfaucett/rs-specs_bundler.git |
max_upload_size | |
id | 39854 |
size | 8,428 |
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);
}