Skip to main content

ProducerEffect

Trait ProducerEffect 

Source
pub trait ProducerEffect:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn variant_id(&self) -> EffectVariantId;
    fn field(&self, id: &FieldId) -> Option<FieldValue<'_>>;
}
Expand description

Marker trait for the seam-effect sum emitted by meerkat-machine-codegen::render_composition_driver. Producer effect enums implement this to expose the typed variant id alongside their domain body — the dispatcher consults it without inspecting the enum.

Required Methods§

Source

fn variant_id(&self) -> EffectVariantId

Typed variant id for this effect value.

The codegen emits one arm per distinct {producer_instance}::{variant} pair; implementers return the matching EffectVariantId. This is the single handle the dispatcher needs to resolve the route without case-matching on the producer’s concrete enum.

Source

fn field(&self, id: &FieldId) -> Option<FieldValue<'_>>

Borrow a field value by FieldId.

Used by the dispatcher to project producer fields into the typed consumer input as declared by the composition’s route bindings. Returns None if the requested field is not present on this variant. The dispatcher treats that as DispatchRefusal::MissingProducerField.

Implementors§