pub trait CuApplication<S: SectionStorage, L: UnifiedLogWrite<S> + 'static> {
// Required methods
fn get_original_config() -> String;
fn start_all_tasks(&mut self) -> CuResult<()>;
fn run_one_iteration(&mut self) -> CuResult<()>;
fn run(&mut self) -> CuResult<()>;
fn stop_all_tasks(&mut self) -> CuResult<()>;
fn restore_keyframe(&mut self, freezer: &KeyFrame) -> CuResult<()>;
}Expand description
A trait that defines the structure and behavior of a CuApplication.
CuApplication is the normal, running on robot version of an application and its runtime.
The CuApplication trait outlines the necessary functions required for managing an application lifecycle,
including configuration management, initialization, task execution, and runtime control. It is meant to be
implemented by types that represent specific applications, providing them with unified control and execution features.
This is the more generic version that allows you to specify a custom unified logger.
Required Methods§
Sourcefn get_original_config() -> String
fn get_original_config() -> String
Returns the original configuration as a string, typically loaded from a RON file. This configuration represents the default settings for the application before any overrides.
Sourcefn start_all_tasks(&mut self) -> CuResult<()>
👎Deprecated since 1.2.0: use the typed transition start() on the handle returned by build()
fn start_all_tasks(&mut self) -> CuResult<()>
use the typed transition start() on the handle returned by build()
Starts all tasks managed by the application/runtime.
§Returns
Ok(())- If all tasks are started successfully.Err(CuResult)- If an error occurs while attempting to start one or more tasks.
Sourcefn run_one_iteration(&mut self) -> CuResult<()>
👎Deprecated since 1.2.0: use run_one_iteration() on the Running handle from build()?.start()?
fn run_one_iteration(&mut self) -> CuResult<()>
use run_one_iteration() on the Running handle from build()?.start()?
Executes a single iteration of copper-generated runtime (generating and logging one copperlist)
§Returns
CuResult<()>- ReturnsOk(())if the iteration completes successfully, or an error wrapped inCuResultif something goes wrong during execution.
Sourcefn run(&mut self) -> CuResult<()>
👎Deprecated since 1.2.0: use the typed transition run_until_shutdown() on the handle returned by build()
fn run(&mut self) -> CuResult<()>
use the typed transition run_until_shutdown() on the handle returned by build()
Runs indefinitely looping over run_one_iteration
§Returns
Returns a CuResult<()>, which indicates the success or failure of the
operation.
- On success, the result is
Ok(()). - On failure, an appropriate error wrapped in
CuResultis returned.
Sourcefn stop_all_tasks(&mut self) -> CuResult<()>
👎Deprecated since 1.2.0: use the typed transition stop() on the Running handle
fn stop_all_tasks(&mut self) -> CuResult<()>
use the typed transition stop() on the Running handle
Stops all tasks managed by the application/runtime.
§Returns
Returns a CuResult<()>, which indicates the success or failure of the
operation.
- On success, the result is
Ok(()). - On failure, an appropriate error wrapped in
CuResultis returned.
Sourcefn restore_keyframe(&mut self, freezer: &KeyFrame) -> CuResult<()>
fn restore_keyframe(&mut self, freezer: &KeyFrame) -> CuResult<()>
Restore all tasks from the given frozen state
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<S, L, A> CuApplication<S, L> for CuAppLifecycle<S, L, A, Initialized>where
S: SectionStorage,
L: UnifiedLogWrite<S> + 'static,
A: CuApplication<S, L>,
Legacy escape hatch: the raw (deprecated) lifecycle API remains callable
on what build() returns, so pre-typestate code compiles unchanged and
only picks up deprecation warnings. Raw calls do not advance the
typestate; mixing them with typed transitions is outside the typestate
guarantees.