pub trait Context {
type State;
// Required methods
fn sim(&mut self) -> &mut Simulation<Self::State>;
fn print_state(
&self,
terminal: &mut impl Terminal,
) -> Result<(), AccessTerminalError>;
fn decoder(&self) -> &Decoder<Self::State>;
}
Expand description
Specification of a minimal application context for simulations.
Required Associated Types§
Required Methods§
Sourcefn sim(&mut self) -> &mut Simulation<Self::State>
fn sim(&mut self) -> &mut Simulation<Self::State>
A mutable reference to the simulation.
Sourcefn print_state(
&self,
terminal: &mut impl Terminal,
) -> Result<(), AccessTerminalError>
fn print_state( &self, terminal: &mut impl Terminal, ) -> Result<(), AccessTerminalError>
Prints the current state to the given terminal interface.
§Errors
AccessTerminalError
if an error occurs while writing to the terminal.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.