Intervenable

Trait Intervenable 

Source
pub trait Intervenable<T> {
    // Required method
    fn intervene(self, new_value: T) -> Self;
}
Expand description

Defines the intervene operation for a monadic effect system. This trait is intended for causal reasoning systems where counterfactuals are modeled by forcing a value at a specific point in a computation chain.

Required Methods§

Source

fn intervene(self, new_value: T) -> Self

Overrides the value within an effectful computation.

This function takes an existing effect (self) and a new_value. It returns a new effect where the original value is discarded and replaced by new_value.

Crucially, it should preserve the context of the computation:

  • Error State: If the incoming effect was already in an error state, that error is propagated. An intervention cannot fix a previously broken chain.
  • Log History: The logs from the incoming effect are preserved, and a new entry is added to signify that an intervention occurred.

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.

Implementors§

Source§

impl<Value, State, Context, Error, Log> Intervenable<Value> for CausalEffectPropagationProcess<Value, State, Context, Error, Log>
where Log: LogAppend + LogAddEntry + Default, Value: Debug,