pub struct CitizenRegistry { /* private fields */ }Expand description
An explicit citizen registry built by naming the citizen types a crate owns.
Inventory remains available for ordinary host binaries, but strict gates and
wasm/LTO builds can construct this registry directly with
CitizenRegistry::register. That path references each citizen type in
ordinary Rust code, so registration does not depend on link-time constructor
retention.
Implementations§
Source§impl CitizenRegistry
impl CitizenRegistry
Sourcepub fn from_inventory() -> Result<Self>
pub fn from_inventory() -> Result<Self>
Builds an explicit registry from the current inventory rows.
This is useful when a caller wants the registry APIs, such as completeness checks or census rendering, while still using inventory as the discovery source.
Sourcepub fn register<T>(&mut self) -> Result<&mut Self>where
T: CitizenRuntime,
pub fn register<T>(&mut self) -> Result<&mut Self>where
T: CitizenRuntime,
Registers the citizen metadata generated for T.
Calling this function is the DCE-safe path: the owning crate names every
citizen type it expects to ship, and the registry is then loadable as a
normal kernel Lib.
Sourcepub fn register_info(&mut self, info: CitizenInfo) -> Result<&mut Self>
pub fn register_info(&mut self, info: CitizenInfo) -> Result<&mut Self>
Registers one citizen metadata row.
Duplicate symbols are rejected so an explicit registry cannot silently shadow two distinct Rust types behind one SIM class symbol.
Sourcepub fn citizens(&self) -> impl Iterator<Item = &CitizenInfo>
pub fn citizens(&self) -> impl Iterator<Item = &CitizenInfo>
Iterates the citizen rows in this explicit registry.
Sourcepub fn missing_symbols<'a>(&self, expected: &'a [&'a str]) -> Vec<&'a str>
pub fn missing_symbols<'a>(&self, expected: &'a [&'a str]) -> Vec<&'a str>
Returns every expected symbol missing from this registry.
Sourcepub fn ensure_contains_symbols(&self, expected: &[&str]) -> Result<()>
pub fn ensure_contains_symbols(&self, expected: &[&str]) -> Result<()>
Fails closed unless this registry contains every expected symbol.
Sourcepub fn install_all(&self, linker: &mut Linker<'_>) -> Result<()>
pub fn install_all(&self, linker: &mut Linker<'_>) -> Result<()>
Installs every citizen row in this registry into linker.
Trait Implementations§
Source§impl Clone for CitizenRegistry
impl Clone for CitizenRegistry
Source§fn clone(&self) -> CitizenRegistry
fn clone(&self) -> CitizenRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more