Skip to main content

Module typed

Module typed 

Source
Expand description

Typed dispatch for AppData components.

Defines the Component trait that pairs a static ComponentId with a value type, encoding, and per-component validation hooks. Each well-known component (GROUP_NAME, ADMIN_LIST, etc.) has one Component impl living under app_data::components::*. Together with the static dispatch table in app_data::registry_table, the trait is the single source of truth for what a ComponentId means at the byte level.

§Type erasure

Component has only static methods (no &self), so dyn Component cannot be formed. The companion ErasedComponent trait is the object-safe shape used for runtime dispatch. A blanket impl over any C: Component + Send + Sync + 'static lets each Component impl be a zero-sized type — &'static dyn ErasedComponent is a single pointer with no per-call boxing.

§Bytes-out, value-out boundary

The trait deliberately splits “byte-in / byte-out” methods (which survive type erasure) from “value-in / value-out” methods (which require the static Self::Value / Self::Mutation types). Validators and the steady-state apply path use the byte-shaped methods through &dyn ErasedComponent; reads against a known component impl use decode_value directly with the static type through the MlsGroupAppData facade in xmtp_mls.

Structs§

ExpandedComponentChange
A single per-element view of an incoming AppDataUpdate proposal.

Enums§

ComponentInvariantError
Errors surfaced by Component::validate_invariant.
ComponentTypedError
Errors surfaced by Component trait methods.

Traits§

Component
A typed view of a well-known AppData component.
ErasedComponent
Object-safe view of a Component impl, for runtime dispatch via &'static dyn ErasedComponent. Carries only the byte-shaped methods — typed reads through decode_value / encode_value / encode_mutation need the static Self::Value / Self::Mutation types and aren’t reachable through the dyn boundary.