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§
Sourcefn intervene(self, new_value: T) -> Self
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
effectwas already in an error state, that error is propagated. An intervention cannot fix a previously broken chain. - Log History: The logs from the incoming
effectare 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.