pub struct CuSimAppLifecycle<S, L, A, State = Initialized> { /* private fields */ }Expand description
Compile-time enforced lifecycle for a CuSimApplication.
Simulation counterpart of CuAppLifecycle: same states and transitions,
with each transition threading the sim_callback the simulation runtime
requires. Replay primitives (replay_recorded_copperlist,
restore_keyframe) are framework-level and stay on the raw traits.
Implementations§
Source§impl<S, L, A, State> CuSimAppLifecycle<S, L, A, State>
impl<S, L, A, State> CuSimAppLifecycle<S, L, A, State>
Sourcepub fn into_inner(self) -> A
pub fn into_inner(self) -> A
Consumes the wrapper and returns the application, dropping the compile-time lifecycle tracking.
Source§impl<S, L, A> CuSimAppLifecycle<S, L, A, Initialized>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
impl<S, L, A> CuSimAppLifecycle<S, L, A, Initialized>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
Source§impl<S, L, A, State> CuSimAppLifecycle<S, L, A, State>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
State: Startable,
impl<S, L, A, State> CuSimAppLifecycle<S, L, A, State>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
State: Startable,
Sourcepub fn start(
self,
sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride,
) -> SimTransitionResult<S, L, A, Running>
pub fn start( self, sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride, ) -> SimTransitionResult<S, L, A, Running>
Starts all tasks, transitioning to Running.
On failure the application may be partially started; it is returned
typed Faulted inside the error so it can be cleaned up.
Sourcepub fn run_until_shutdown(
self,
sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride,
) -> SimTransitionResult<S, L, A, Stopped>
pub fn run_until_shutdown( self, sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride, ) -> SimTransitionResult<S, L, A, Stopped>
Runs the full lifecycle (start, iterate until shutdown, stop),
transitioning to Stopped on success.
Source§impl<S, L, A> CuSimAppLifecycle<S, L, A, Running>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
impl<S, L, A> CuSimAppLifecycle<S, L, A, Running>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
Sourcepub fn run_one_iteration(
&mut self,
sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride,
) -> CuResult<()>
pub fn run_one_iteration( &mut self, sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride, ) -> CuResult<()>
Executes one iteration of the runtime. An iteration error does not change the lifecycle state: the caller decides whether to keep iterating or stop.
Source§impl<S, L, A, State> CuSimAppLifecycle<S, L, A, State>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
State: Stoppable,
impl<S, L, A, State> CuSimAppLifecycle<S, L, A, State>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
State: Stoppable,
Sourcepub fn stop(
self,
sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride,
) -> SimTransitionResult<S, L, A, Stopped>
pub fn stop( self, sim_callback: &mut impl for<'z> FnMut(<A as CuSimApplication<S, L>>::Step<'z>) -> SimOverride, ) -> SimTransitionResult<S, L, A, Stopped>
Stops all tasks, transitioning to Stopped. From Faulted this is a
best-effort cleanup. On failure the application is handed back typed
Faulted again.
Trait Implementations§
Source§impl<S, L, A> CuSimApplication<S, L> for CuSimAppLifecycle<S, L, A, Initialized>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
Available on crate feature std only.Legacy escape hatch mirroring the CuApplication impl on
CuAppLifecycle: pre-typestate simulation code compiles unchanged
against what build() returns and only picks up deprecation warnings.
impl<S, L, A> CuSimApplication<S, L> for CuSimAppLifecycle<S, L, A, Initialized>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuSimApplication<S, L>,
std only.Legacy escape hatch mirroring the CuApplication impl on
CuAppLifecycle: pre-typestate simulation code compiles unchanged
against what build() returns and only picks up deprecation warnings.
Source§type Step<'z> = <A as CuSimApplication<S, L>>::Step<'z>
type Step<'z> = <A as CuSimApplication<S, L>>::Step<'z>
Source§fn get_original_config() -> String
fn get_original_config() -> String
Source§fn mission_id() -> Option<&'static str>
fn mission_id() -> Option<&'static str>
Source§fn start_all_tasks(
&mut self,
sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride,
) -> CuResult<()>
fn start_all_tasks( &mut self, sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride, ) -> CuResult<()>
use the typed transition start() on the handle returned by build()
Source§fn run_one_iteration(
&mut self,
sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride,
) -> CuResult<()>
fn run_one_iteration( &mut self, sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride, ) -> CuResult<()>
use run_one_iteration() on the Running handle from build()?.start()?
Source§fn run(
&mut self,
sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride,
) -> CuResult<()>
fn run( &mut self, sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride, ) -> CuResult<()>
use the typed transition run_until_shutdown() on the handle returned by build()
Source§fn stop_all_tasks(
&mut self,
sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride,
) -> CuResult<()>
fn stop_all_tasks( &mut self, sim_callback: &mut impl for<'z> FnMut(Self::Step<'z>) -> SimOverride, ) -> CuResult<()>
use the typed transition stop() on the Running handle
Source§fn restore_keyframe(&mut self, freezer: &KeyFrame) -> CuResult<()>
fn restore_keyframe(&mut self, freezer: &KeyFrame) -> CuResult<()>
Source§impl<S, L, A, State> Debug for CuSimAppLifecycle<S, L, A, State>
Available on crate feature std only.
impl<S, L, A, State> Debug for CuSimAppLifecycle<S, L, A, State>
std only.Source§impl<S, L, A, State> Deref for CuSimAppLifecycle<S, L, A, State>
Available on crate feature std only.Read access to the wrapped application in every lifecycle state.
impl<S, L, A, State> Deref for CuSimAppLifecycle<S, L, A, State>
std only.Read access to the wrapped application in every lifecycle state.
Source§impl<S, L, A> DerefMut for CuSimAppLifecycle<S, L, A, Initialized>
Available on crate feature std only.Mutable access only before the application is started, mirroring
CuAppLifecycle.
impl<S, L, A> DerefMut for CuSimAppLifecycle<S, L, A, Initialized>
std only.Mutable access only before the application is started, mirroring
CuAppLifecycle.
Auto Trait Implementations§
impl<S, L, A, State> Freeze for CuSimAppLifecycle<S, L, A, State>
impl<S, L, A, State> RefUnwindSafe for CuSimAppLifecycle<S, L, A, State>
impl<S, L, A, State> Send for CuSimAppLifecycle<S, L, A, State>
impl<S, L, A, State> Sync for CuSimAppLifecycle<S, L, A, State>
impl<S, L, A, State> Unpin for CuSimAppLifecycle<S, L, A, State>
impl<S, L, A, State> UnsafeUnpin for CuSimAppLifecycle<S, L, A, State>
impl<S, L, A, State> UnwindSafe for CuSimAppLifecycle<S, L, A, State>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more