pub trait Driver {
// Required methods
fn start(&mut self) -> Result<(), CnResult>;
fn run(self: Box<Self>) -> Result<(), CnResult>;
fn into_world(self: Box<Self>) -> World;
}Expand description
A loop that runs a World.
App is the implementation with nothing underneath it: a fixed virtual
timestep, no window, and no wall clock. A host that has an operating system
implements this over its own loop, and what such a host adds – pacing a
frame against a display, following real elapsed time, catching a signal –
stays on its side of the seam.
run reports whether the run failed rather than how it
ended. A StepResult is a system’s verdict on its
own tick, and a host ends a run for reasons no system sees, so a driver that
reported one would owe readings for them.
run consumes the driver, since a run ends the world it was handed;
into_world is the other way out, for a caller that
wants the world back instead of run.
Required Methods§
Sourcefn into_world(self: Box<Self>) -> World
fn into_world(self: Box<Self>) -> World
Take the world back instead of running it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".