initialize chained systems (#886)

This commit is contained in:
Carter Anderson 2020-11-17 17:06:47 -08:00 committed by GitHub
parent 457a8bd17d
commit 4fecb899aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -49,5 +49,5 @@ pub trait System: Send + Sync + 'static {
unsafe { self.run_unsafe(input, world, resources) }
}
fn run_thread_local(&mut self, world: &mut World, resources: &mut Resources);
fn initialize(&mut self, _world: &mut World, _resources: &mut Resources) {}
fn initialize(&mut self, _world: &mut World, _resources: &mut Resources);
}

View file

@ -68,6 +68,11 @@ impl<SystemA: System, SystemB: System<Input = SystemA::Output>> System
self.system_a.run_thread_local(world, resources);
self.system_b.run_thread_local(world, resources);
}
fn initialize(&mut self, world: &mut World, resources: &mut Resources) {
self.system_a.initialize(world, resources);
self.system_b.initialize(world, resources);
}
}
pub trait IntoChainSystem<AParams, BParams, IntoB, SystemA, SystemB>: