Skip to main content

Context

Trait Context 

Source
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§

Source

type State

The state type.

Required Methods§

Source

fn sim(&mut self) -> &mut Simulation<Self::State>

A mutable reference to the simulation.

Source

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.

Source

fn decoder(&self) -> &Decoder<Self::State>

A reference to a decoder for parsing events.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§