Skip to main content

CompositionDispatcher

Trait CompositionDispatcher 

Source
pub trait CompositionDispatcher: Send + Sync {
    type Effect: ProducerEffect;

    // Required methods
    fn composition(&self) -> &CompositionId;
    fn dispatch<'life0, 'async_trait>(
        &'life0 self,
        producer: ProducerInstance,
        effect: EffectPayload<Self::Effect>,
    ) -> Pin<Box<dyn Future<Output = Result<DispatchOutcome, DispatchRefusal>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Composition dispatcher trait.

Monomorphized over the producer composition’s seam-effect sum (CompositionDispatcher::Effect). Making the effect an associated type (rather than a generic on the method) keeps the trait dyn-safe — a MeerkatMachine can hold Arc<dyn CompositionDispatcher<Effect = ...>> without leaking the machine kernel’s monomorphization concerns.

Required Associated Types§

Source

type Effect: ProducerEffect

Seam-effect sum this dispatcher handles. Matches the codegen-emitted {Composition}Effect enum.

Required Methods§

Source

fn composition(&self) -> &CompositionId

Composition id this dispatcher owns. Every ProducerInstance passed to CompositionDispatcher::dispatch must match.

Source

fn dispatch<'life0, 'async_trait>( &'life0 self, producer: ProducerInstance, effect: EffectPayload<Self::Effect>, ) -> Pin<Box<dyn Future<Output = Result<DispatchOutcome, DispatchRefusal>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dispatch a routed effect. Returns DispatchOutcome on success or a typed DispatchRefusal. There is no silent-drop arm.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§