Skip to main content

Family

Trait Family 

Source
pub trait Family:
    Sealed
    + Clone
    + Copy
    + Send
    + Sync
    + 'static {
    type Request: WasmCompatSend + 'static;
    type Answer: WasmCompatSend + 'static;

    const FAMILY: EffectFamily;

    // Required methods
    fn wrap(request: Self::Request) -> Result<EffectKind, ErrorReport>;
    fn unwrap(outcome: Outcome) -> Result<Self::Answer, ErrorReport>;

    // Provided method
    fn mismatch(outcome: &Outcome) -> ErrorReport { ... }
}
Expand description

Sealed mapping between typed requests and answers and the wire’s EffectKind and Outcome. Hosts extend the protocol through CustomEffect and family::Custom, not new family implementations.

Required Associated Constants§

Source

const FAMILY: EffectFamily

The family this marker names.

Required Associated Types§

Source

type Request: WasmCompatSend + 'static

What a typed dispatch of this family takes.

Source

type Answer: WasmCompatSend + 'static

What it resolves to.

Required Methods§

Source

fn wrap(request: Self::Request) -> Result<EffectKind, ErrorReport>

The wire form of a request, or the report for a request that has none (a CustomEffect whose Serialize fails). The in-tree families always have one; a typed dispatch of a request without one is pre-failed by the bus and never reaches a handler or a log.

Source

fn unwrap(outcome: Outcome) -> Result<Self::Answer, ErrorReport>

The typed answer, or the report for an outcome of another family.

Provided Methods§

Source

fn mismatch(outcome: &Outcome) -> ErrorReport

The report Family::unwrap gives for an outcome of another family.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§