pub trait ComputationStep<CONTEXT, STATE, OUTPUT> {
// Required method
fn step(context: &CONTEXT, state: &mut STATE) -> Completable<OUTPUT>;
}Expand description
Defines a single step of a Computation.
Implement this trait to define the logic for advancing a computation.
Each call to step should either:
- Return
Ok(output)if the computation is complete - Return
Err(Incomplete::Suspended)to yield control and allow resumption later - Return
Err(Incomplete::Cancelled(_))if cancellation was detected
§Type Parameters
CONTEXT: Immutable configuration/input for the computationSTATE: Mutable state that persists across stepsOUTPUT: The final result type of the computation
Required Methods§
Sourcefn step(context: &CONTEXT, state: &mut STATE) -> Completable<OUTPUT>
fn step(context: &CONTEXT, state: &mut STATE) -> Completable<OUTPUT>
Execute one step of the computation.
This method is called repeatedly until it returns Ok(output).
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.