Skip to main content

CitizenRuntime

Trait CitizenRuntime 

Source
pub trait CitizenRuntime:
    Citizen
    + Object
    + ObjectCompat
    + ObjectEncode
    + PartialEq
    + Debug {
    // Required methods
    fn citizen_info() -> CitizenInfo;
    fn conformance(cx: &mut Cx) -> Result<()>;
    fn construct_from_values(cx: &mut Cx, args: Vec<Value>) -> Result<Self>;
    fn example() -> Self;

    // Provided method
    fn install(linker: &mut Linker<'_>) -> Result<()>
       where Self: Sized { ... }
}
Expand description

A fully runnable citizen: identity plus kernel object and read-construct.

Combines Citizen with the kernel object, encoding, and equality bounds needed to install the type as a class and round-trip it through read-construct. Read-construct stays capability-gated by the runtime path, not by implementing this trait.

Required Methods§

Source

fn citizen_info() -> CitizenInfo

Returns the static registry row for this citizen type.

The derive emits this metadata independently of the inventory row, so a crate can register its citizens explicitly with CitizenRegistry::register in builds where link-time constructor collection is unsuitable.

Source

fn conformance(cx: &mut Cx) -> Result<()>

Runs this citizen’s conformance fixture set.

Source

fn construct_from_values(cx: &mut Cx, args: Vec<Value>) -> Result<Self>

Builds the citizen from decoded constructor argument values.

Source

fn example() -> Self

Returns the canonical example value used as a conformance fixture.

Provided Methods§

Source

fn install(linker: &mut Linker<'_>) -> Result<()>
where Self: Sized,

Installs this citizen’s class into a kernel linker.

The default implementation backs the generated registry row without reserving an inherent helper name on the user’s type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§