Skip to main content

ConsumerSurface

Trait ConsumerSurface 

Source
pub trait ConsumerSurface: Send + Sync {
    // Required methods
    fn instance_id(&self) -> &MachineInstanceId;
    fn apply_routed_input<'life0, 'async_trait>(
        &'life0 self,
        variant: InputVariantId,
        projected_fields: Vec<(FieldId, OwnedFieldValue)>,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Delivery surface for one consumer instance inside a composition.

A consumer (e.g. the meerkat machine instance when mob routes RequestRuntimeBinding at it) implements this trait and registers an instance at composition wire-up. The dispatcher invokes it exactly once per resolved [RoutedInput]. The implementation is responsible for materializing the consumer-side typed input — the dispatcher only moves typed data across the seam.

Required Methods§

Source

fn instance_id(&self) -> &MachineInstanceId

Instance id this surface serves. The dispatcher matches against [RoutedInput::instance_id] to pick the right surface.

Source

fn apply_routed_input<'life0, 'async_trait>( &'life0 self, variant: InputVariantId, projected_fields: Vec<(FieldId, OwnedFieldValue)>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Apply a typed routed input. projected_fields carries the per- consumer-field values resolved from the producer via the route’s field-bindings, owned so the surface can move them into its typed input constructor.

Implementors§