Skip to main content

DecisionHandler

Trait DecisionHandler 

Source
pub trait DecisionHandler:
    Send
    + Sync
    + Debug {
    // Required method
    fn handle_decision<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 TransactionContext,
        decision: &'life2 Decision,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for handling FSM decision points.

When the FSM reaches a state that requires an external decision (e.g., whether to authorize a new transfer), the StandardTransactionProcessor calls the configured DecisionHandler.

Implementations can auto-approve, publish to an event bus, call out to a compliance API, present a UI to a human operator, etc.

Required Methods§

Source

fn handle_decision<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 TransactionContext, decision: &'life2 Decision, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Called when the FSM produces a Decision.

The handler receives the full TransactionContext (current state, per-agent status) and the Decision describing what needs to be resolved.

Implementations that auto-resolve should return the same Decision back. Implementations that defer to external systems should publish the decision and return it for auditing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§