Skip to main content

TriggerPrimitive

Trait TriggerPrimitive 

Source
pub trait TriggerPrimitive: Send + Sync {
    // Required methods
    fn manifest(&self) -> &TriggerPrimitiveManifest;
    fn evaluate(
        &self,
        inputs: &HashMap<String, TriggerValue>,
        parameters: &HashMap<String, ParameterValue>,
    ) -> HashMap<String, TriggerValue>;
}
Expand description

A trigger primitive that evaluates inputs and emits events.

§TRG-STATE-1: Stateless Triggers

Triggers are stateless across runs. The runtime API intentionally does not support persisted trigger state. Implementations may use ephemeral evaluation-local memory only (e.g., stack variables within evaluate()), but no state may be preserved, observed, or depended upon between invocations.

Temporal patterns requiring memory (once, latch, debounce, count) must be implemented as clusters where state flows through graph structure or environment, not trigger internals.

Statelessness is enforced at registration by manifest validation (TRG-9, state.allowed == false) and at runtime by capture/replay. Structural enforcement on top (derive macros, marker traits, newtype wrappers) was considered and rejected; see docs/ledger/decisions/rejected-structural-enforcement-of-statelessness.md.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§