pub struct SimulationBorrow<'a, Info: SimulationInfo, StateRef> {
pub state: StateRef,
/* private fields */
}Expand description
A generic struct representing a borrowed simulation with an immutable or mutable reference to the state.
Fields§
§state: StateRefThe referenced simulation state.
Trait Implementations§
Source§impl<Info: SimulationInfo, S> Deref for SimulationBorrow<'_, Info, S>
impl<Info: SimulationInfo, S> Deref for SimulationBorrow<'_, Info, S>
Source§impl<Info: SimulationInfo, S: BorrowMut<Info::State>> Simulation for SimulationBorrow<'_, Info, S>
impl<Info: SimulationInfo, S: BorrowMut<Info::State>> Simulation for SimulationBorrow<'_, Info, S>
Source§type StateLoadingError = <Info as SimulationInfo>::StateLoadingError
type StateLoadingError = <Info as SimulationInfo>::StateLoadingError
The error type returned when loading the simulation state fails.
Source§type LoadData = <Info as SimulationInfo>::LoadData
type LoadData = <Info as SimulationInfo>::LoadData
The type of data used to load the simulation state.
Source§fn reload(
&mut self,
data: Info::LoadData,
) -> Result<(), Info::StateLoadingError>
fn reload( &mut self, data: Info::LoadData, ) -> Result<(), Info::StateLoadingError>
Reloads the simulation state from the provided data.
Source§fn try_call(&mut self, event: Self::Event) -> bool
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
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>
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>
fn prepare_revert(&mut self) -> CallState<'_, Self, Revert>
Prepares a safe helper to list revertable elements and choose one to revert.
Source§impl<Info: SimulationInfo, S: Borrow<Info::State>> SimulationState for SimulationBorrow<'_, Info, S>
impl<Info: SimulationInfo, S: Borrow<Info::State>> SimulationState for SimulationBorrow<'_, Info, S>
Source§type AccessData = <Info as SimulationInfo>::AccessData
type AccessData = <Info as SimulationInfo>::AccessData
The type used to access the current state data.
Source§type Event = <Info as SimulationInfo>::Event
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
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
fn data(&self) -> &Info::AccessData
Returns a reference to the data which represents the current state.
Source§fn callables(&self) -> Info::EventContainer<'_>
fn callables(&self) -> Info::EventContainer<'_>
Returns the events that can be called in the current state.
Source§fn callable(&self, event: Info::Event) -> bool
fn callable(&self, event: Info::Event) -> bool
Checks if the provided event can be called in the current state.
Source§fn revertables(&self) -> Info::EventContainer<'_>
fn revertables(&self) -> Info::EventContainer<'_>
Returns the events that can be reverted in the current state.
Source§fn revertable(&self, event: Info::Event) -> bool
fn revertable(&self, event: Info::Event) -> bool
Checks if the provided event can be reverted in the current state.
Auto Trait Implementations§
impl<'a, Info, StateRef> Freeze for SimulationBorrow<'a, Info, StateRef>where
StateRef: Freeze,
impl<'a, Info, StateRef> RefUnwindSafe for SimulationBorrow<'a, Info, StateRef>where
StateRef: RefUnwindSafe,
Info: RefUnwindSafe,
impl<'a, Info, StateRef> Send for SimulationBorrow<'a, Info, StateRef>
impl<'a, Info, StateRef> Sync for SimulationBorrow<'a, Info, StateRef>
impl<'a, Info, StateRef> Unpin for SimulationBorrow<'a, Info, StateRef>where
StateRef: Unpin,
impl<'a, Info, StateRef> UnsafeUnpin for SimulationBorrow<'a, Info, StateRef>where
StateRef: UnsafeUnpin,
impl<'a, Info, StateRef> UnwindSafe for SimulationBorrow<'a, Info, StateRef>where
StateRef: UnwindSafe,
Info: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more