pub trait DeterministicBrick: Brick {
type State: Clone + Default;
type Input;
type Output;
// Required method
fn execute_pure(
state: Self::State,
input: Self::Input,
) -> Result<(Self::State, Self::Output), BrickError>;
// Provided methods
fn initial_state() -> Self::State { ... }
fn state_dependencies(&self) -> &[&str] { ... }
}Expand description
Trait for bricks with deterministic, pure functional execution
Required Associated Types§
Required Methods§
Sourcefn execute_pure(
state: Self::State,
input: Self::Input,
) -> Result<(Self::State, Self::Output), BrickError>
fn execute_pure( state: Self::State, input: Self::Input, ) -> Result<(Self::State, Self::Output), BrickError>
Pure function: (state, input) → (new_state, output)
This function MUST be:
- Deterministic: same inputs → same outputs
- Pure: no side effects
- Total: always returns or errors (no panics)
Provided Methods§
Sourcefn initial_state() -> Self::State
fn initial_state() -> Self::State
Create initial state
Sourcefn state_dependencies(&self) -> &[&str]
fn state_dependencies(&self) -> &[&str]
Get state dependencies for determinism verification
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".