Struct OwnedSimulation

Source
pub struct OwnedSimulation<Info: SimulationInfo> {
    pub state: Info::State,
    /* private fields */
}
Expand description

An owned simulation that holds the simulation info and the simulation state.

Fields§

§state: Info::State

The simulation state.

Implementations§

Source§

impl<Info: SimulationInfo> OwnedSimulation<Info>

Source

pub fn new<T: Into<Info>>(info: T) -> Self

Creates a new OwnedSimulation using the specified info.

Source

pub fn from_data( info: Info, data: Info::LoadData, ) -> Result<Self, Info::StateLoadingError>

Loads a new OwnedSimulation from data using the specified info.

Source

pub fn release(self) -> Info

Release the info from the simulation again and destroys all states.

Trait Implementations§

Source§

impl<Info: SimulationInfo + Clone> Clone for OwnedSimulation<Info>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Info: SimulationInfo> Deref for OwnedSimulation<Info>

Source§

type Target = Info

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Info

Dereferences the value.
Source§

impl<Info: EditableSimulationInfo> Editable for OwnedSimulation<Info>

Source§

type Edit<'a> = OwnedSimulationEdit<'a, Info> where Self: 'a

The type used for safe edits and refreshing the state.
Source§

fn edit(&mut self) -> OwnedSimulationEdit<'_, Info>

Creates a type which allows safe edits to the info without invalidating the states, and automatically refreshes the states when the edit type goes out of scope.
Source§

impl<Info: SimulationInfo> Simulation for OwnedSimulation<Info>

Source§

type StateLoadingError = <Info as SimulationInfo>::StateLoadingError

The error type returned when loading the simulation state fails.
Source§

type AccessData = <Info as SimulationInfo>::AccessData

The type used to access the current state.
Source§

type LoadData = <Info as SimulationInfo>::LoadData

The type of data used to load the simulation state.
Source§

type Event = <Info as SimulationInfo>::Event

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

type EventContainer<'a> = <Info as SimulationInfo>::EventContainer<'a> where Self: 'a

The type of container used to access the available events.
Source§

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

Returns a reference to the data which repsesents the current state.
Source§

fn reload( &mut self, data: Info::LoadData, ) -> Result<(), Info::StateLoadingError>

Reloads the simulation state from the provided data.
Source§

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

Returns the events that can currently be called.
Source§

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

Checks if the provided event can be called.
Source§

unsafe fn call(&mut self, event: Info::Event)

Calls the provided event. Read more
Source§

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

Returns the events that can currently be reverted.
Source§

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

Checks if the provided event can be reverted.
Source§

unsafe fn revert(&mut self, event: Info::Event)

Reverts the provided event. Read more
Source§

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

Tries to call the provided event and returns if it was successful.
Source§

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

Tries to revert the provided event and returns if it was successful.
Source§

fn prepare_call(&mut self) -> CallState<'_, Self, Call>

Prepares a safe helper to list callable elements and choose one to call.
Source§

fn prepare_revert(&mut self) -> CallState<'_, Self, Revert>

Prepares a safe helper to list revertable elements and choose one to revert.

Auto Trait Implementations§

§

impl<Info> Freeze for OwnedSimulation<Info>
where Info: Freeze, <Info as SimulationInfo>::State: Freeze,

§

impl<Info> RefUnwindSafe for OwnedSimulation<Info>

§

impl<Info> Send for OwnedSimulation<Info>
where Info: Send, <Info as SimulationInfo>::State: Send,

§

impl<Info> Sync for OwnedSimulation<Info>
where Info: Sync, <Info as SimulationInfo>::State: Sync,

§

impl<Info> Unpin for OwnedSimulation<Info>
where Info: Unpin, <Info as SimulationInfo>::State: Unpin,

§

impl<Info> UnwindSafe for OwnedSimulation<Info>
where Info: UnwindSafe, <Info as SimulationInfo>::State: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.