Expand description
Static dispatch table for well-known [Component] impls.
Maps each well-known ComponentId to its zero-sized
ErasedComponent impl so dispatch sites can resolve a runtime
ComponentId to the right per-component logic without per-call
boxing. The table is hand-maintained and sorted by
ComponentId::as_u16() so lookup_component does a single
binary search.
§Adding a new well-known component
- Add a
Componentimpl inapp_data::components::*. - Insert a
(ComponentId::FOO, &FooComponent)entry intoWELL_KNOWN, maintaining ascending sort order. - The compile-time
assert_table_is_sorted_and_uniquecheck at the bottom of this file verifies invariants on every build.
Custom (host-registered) components live outside this table — see
app_data::custom (added in jj change #14) for the runtime
registration path.
Statics§
- WELL_
KNOWN - Sorted-ascending table of
(ComponentId, &dyn ErasedComponent)entries for every well-known XMTP component.
Functions§
- lookup_
component - Look up the
ErasedComponentfor aComponentId.