EditableSimulationInfo

Trait EditableSimulationInfo 

Source
pub trait EditableSimulationInfo: SimulationInfo {
    type Edit<'a>: Deref<Target = Self>
       where Self: 'a;

    // Required methods
    unsafe fn edit(&mut self) -> Self::Edit<'_>;
    unsafe fn refresh_state(&self, state: &mut Self::State);
}
Expand description

The EditalbeSimulationInfo trait provides an interface for editing the simulation while ensuring the state to stay valid.

Required Associated Types§

Source

type Edit<'a>: Deref<Target = Self> where Self: 'a

The type used for safe edits.

Required Methods§

Source

unsafe fn edit(&mut self) -> Self::Edit<'_>

Creates a type which allows safe edits to the info without invalidating the states.

§Safety

After editing the info using the edit type, refresh_state has to be called before continuing the simulation.

Source

unsafe fn refresh_state(&self, state: &mut Self::State)

Refreshes the provided mutable state, assuming it is compatible with this SimulationInfo instance.

§Safety

The caller must ensure that the provided state is compatible with this SimulationInfo instance.

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§