Trait specs::BatchController [−][src]
pub trait BatchController<'a, 'b, 'c> { type BatchSystemData: SystemData<'c>; fn run(&mut self, world: &'c World, dispatcher: &mut Dispatcher<'a, 'b>); fn running_time(&self) -> RunningTime { ... } }
Expand description
The BatchController
describes things that allow one to control how batches of systems are
executed.
A batch is a set of systems represented as a dispatcher (a sub-dispatcher, if you like).
It is registered with add_batch
, together with the
corresponding sub-dispatcher.
See the batch_dispatching example.
The MultiDispatcher
may help with implementing this in most common cases.
Associated Types
type BatchSystemData: SystemData<'c>
[src]
type BatchSystemData: SystemData<'c>
[src]This associated type has to contain all resources batch controller uses directly.
Note that these are not fetched automatically for the controller, as is the case with
ordinary System
s. This is because the fetched references might need to be dropped
before actually dispatching the other systems to avoid collisions on them and it would not
be possible to perform using a parameter.
Therefore, these are only declared here, but not automatically fetched. If the declaration does not match reality, the scheduler might make suboptimal decisions (if this declares more than is actually needed) or it may panic in runtime (in case it declares less and there happens to be a collision).
Required methods
fn run(&mut self, world: &'c World, dispatcher: &mut Dispatcher<'a, 'b>)
[src]
fn run(&mut self, world: &'c World, dispatcher: &mut Dispatcher<'a, 'b>)
[src]The body of the controller.
It is allowed to fetch (manually) and examine its
BatchSystemData
. Then it shall drop all fetched
references and is free to call dispatcher.dispatch(world)
as many time as it sees fit.
Provided methods
fn running_time(&self) -> RunningTime
[src]
fn running_time(&self) -> RunningTime
[src]Estimate how heavy the whole controller, including the sub-systems, is in terms of computation costs.
Implementations on Foreign Types
impl<'a, 'b, 'c, C> BatchController<'a, 'b, 'c> for MultiDispatcher<C> where
C: MultiDispatchController<'c>,
[src]
impl<'a, 'b, 'c, C> BatchController<'a, 'b, 'c> for MultiDispatcher<C> where
C: MultiDispatchController<'c>,
[src]type BatchSystemData = <C as MultiDispatchController<'c>>::SystemData