Skip to main content

CitizenRegistry

Struct CitizenRegistry 

Source
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

Source

pub fn new() -> Self

Builds an empty explicit registry.

Source

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.

Source

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.

Source

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.

Source

pub fn citizens(&self) -> impl Iterator<Item = &CitizenInfo>

Iterates the citizen rows in this explicit registry.

Source

pub fn len(&self) -> usize

Returns the number of citizen rows in this explicit registry.

Source

pub fn is_empty(&self) -> bool

Reports whether this explicit registry has no citizen rows.

Source

pub fn missing_symbols<'a>(&self, expected: &'a [&'a str]) -> Vec<&'a str>

Returns every expected symbol missing from this registry.

Source

pub fn ensure_contains_symbols(&self, expected: &[&str]) -> Result<()>

Fails closed unless this registry contains every expected symbol.

Source

pub fn install_all(&self, linker: &mut Linker<'_>) -> Result<()>

Installs every citizen row in this registry into linker.

Source

pub fn install_namespace( &self, linker: &mut Linker<'_>, namespace: &str, ) -> Result<()>

Installs only the citizen rows whose symbols are in namespace.

Trait Implementations§

Source§

impl Clone for CitizenRegistry

Source§

fn clone(&self) -> CitizenRegistry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for CitizenRegistry

Source§

fn default() -> CitizenRegistry

Returns the “default value” for a type. Read more
Source§

impl Lib for CitizenRegistry

Source§

fn manifest(&self) -> LibManifest

Returns the library’s manifest.
Source§

fn load(&self, _cx: &mut LoadCx, linker: &mut Linker<'_>) -> Result<()>

Registers the library’s exports against the registry via linker.
Source§

fn unload(&self, _cx: &mut Cx, _linker: &mut Linker<'_>) -> Result<(), Error>

Tears down external resources that cannot be represented in the registry’s recorded load delta. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.