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

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 Systems. 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

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

Estimate how heavy the whole controller, including the sub-systems, is in terms of computation costs.

Implementations on Foreign Types