Skip to content

core(message): rebuild from kameo reference — Message trait + Context dispatch #114

Description

@joeldsouzax

Part of the core-rebuild epic — follows the shared rigor contract there.

Component

src/message.rs (~456 LOC). Message<T> (handle), Context (reply channel + actor ref), the CQRS message-vs-query split, type-erased DynMessage/BoxMessage.

Learning & discussion

Local tier: T: Send + 'static, no serialization. A message gets exclusive &mut self, processed sequentially; the query path can run reads concurrently. Context is how a handler replies / stops.

Existing crates

downcast-rs, dyn-clone (already used) — evaluate keeping vs a leaner type-erasure.

Research — best algorithm/approach

Type-erased dynamic dispatch patterns; CQRS command/query separation and its concurrency benefit; zero-cost handler wiring.

Testing — hard as fuck

Sequence/protocol (handler ordering, reply-exactly-once), lifecycle, defensive boundary (wrong-type downcast must not UB). DST over interleaved message/query. Mutation: cargo-mutants, zero survivors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions