Skip to main content

Interpret

Trait Interpret 

Source
pub trait Interpret {
    type Effect;

    // Required method
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        scope: &'life1 EffectScope,
        effect: Self::Effect,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Runs the effects produced by a protocol’s pure step. run returns the payloads to re-inject into the router; each is re-delivered to this protocol’s own namespace with from = this node — the router sets the provenance, so a shell can forge neither a namespace nor a remote from. A hard failure is an Err. Defined per-effect outcomes (e.g. “addressed no live session”) are the extension’s own concern and surfaced however it likes (its own return shapes / tests), not a core enum.

Required Associated Types§

Source

type Effect

The effect algebra this shell interprets — the same as its protocol’s Effect.

Required Methods§

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 self, scope: &'life1 EffectScope, effect: Self::Effect, ) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run one effect against the scoped capability, returning self-injected payloads (each re-decoded by this same protocol).

The state transition is committed before this method starts. Effects are attempted in their transition order; an Err stops the current transition’s remaining effects and does not roll state back. A protocol that needs retry or compensation therefore models it as a later typed event/transition, rather than relying on an interpreter retry.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§