Skip to main content

lookup_component

Function lookup_component 

Source
pub fn lookup_component(id: ComponentId) -> Option<&'static dyn ErasedComponent>
Expand description

Look up the ErasedComponent for a ComponentId.

The two sources are disjoint by construction — WELL_KNOWN entries all sit in the XMTP range (0x8000-0xBFFF) and runtime entries are gated to the app range (0xC000-0xFEFF) at registration time — so we route by id space and skip the wrong table entirely:

  1. XMTP range → binary-search the static WELL_KNOWN table.
  2. App range → consult the process-global runtime registry ([super::custom::lookup_runtime_component]).
  3. Reserved range (0xFF00-0xFFFF) → no dispatch.

Returns None if the id is in a known range but has no impl registered (e.g. the 0xBE0x immutable seeds — handled by the bootstrap validator’s byte-compare path rather than the trait).