Trait bones_lib::SessionRunner
source · pub trait SessionRunner: Sync + Send + 'static {
// Required methods
fn step(
&mut self,
now: Instant,
world: &mut World,
stages: &mut SystemStages,
);
fn restart_session(&mut self);
fn disable_local_input(&mut self, input_disabled: bool);
}
Expand description
A session runner is in charge of advancing a Session
simulation.
Required Methods§
sourcefn step(&mut self, now: Instant, world: &mut World, stages: &mut SystemStages)
fn step(&mut self, now: Instant, world: &mut World, stages: &mut SystemStages)
Step the simulation once.
It is the responsibility of the session runner to update the Time
resource if necessary.
If no special behavior is desired, the simplest session runner, and the one that is
implemented by DefaultSessionRunner
is as follows:
fn step(&mut self, now: Instant, world: &mut World, stages: &mut SystemStages) {
world.resource_mut::<Time>().update_with_instant(now);
stages.run(world);
}
fn restart_session(&mut self) {}
fn disable_local_input(&mut self, disable_input: bool) {}
sourcefn restart_session(&mut self)
fn restart_session(&mut self)
Restart Session Runner. This should reset accumulated time, inputs, etc.
The expectation is that current players using it may continue to, so something like a network socket or player info should persist.
sourcefn disable_local_input(&mut self, input_disabled: bool)
fn disable_local_input(&mut self, input_disabled: bool)
Disable the capture of local input by this session.