Skip to main content

SimulationState

Trait SimulationState 

Source
pub trait SimulationState {
    type AccessData: ?Sized;
    type Event: Copy + Ord;
    type EventContainer<'a>: Iterator<Item = Self::Event>
       where Self: 'a;

    // Required methods
    fn data(&self) -> &Self::AccessData;
    fn callables(&self) -> Self::EventContainer<'_>;
    fn revertables(&self) -> Self::EventContainer<'_>;
    fn callable(&self, event: Self::Event) -> bool;
    fn revertable(&self, event: Self::Event) -> bool;
}
Expand description

The SimulationState trait provides a read-only interface for inspecting the current state of a simulation.

Required Associated Types§

Source

type AccessData: ?Sized

The type used to access the current state data.

Source

type Event: Copy + Ord

The type of events that can be called or reverted in the simulation.

Source

type EventContainer<'a>: Iterator<Item = Self::Event> where Self: 'a

The type of container used to access the available events.

Required Methods§

Source

fn data(&self) -> &Self::AccessData

Returns a reference to the data which represents the current state.

Source

fn callables(&self) -> Self::EventContainer<'_>

Returns the events that can be called in the current state.

Source

fn revertables(&self) -> Self::EventContainer<'_>

Returns the events that can be reverted in the current state.

Source

fn callable(&self, event: Self::Event) -> bool

Checks if the provided event can be called in the current state.

Source

fn revertable(&self, event: Self::Event) -> bool

Checks if the provided event can be reverted in the current state.

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.

Implementors§