Expand description
Citizen support outside the SIM kernel.
A citizen is a public SIM-facing runtime value with a class-backed read
constructor, constructor encoding, conformance fixture, and census row.
Domain values usually opt in with #[derive(Citizen)]; hard cases may
register hand-written citizens, and live handles carry inline
#[non_citizen(reason = "...", kind = "...", descriptor = "...")]
exemptions that name their descriptor strategy.
This crate owns only the shared support layer: registry rows, runtime installation helpers, fixture checks, generated census rendering, and the semantic equality helpers used by the strict citizen gate. Read-construct remains capability-gated by the codec/runtime path, not by this crate.
§Surface
Conformance fixtures check a citizen’s read-construct round trip; the field and equality traits encode citizen fields and back the strict semantic equality gate; the registry and runtime helpers install citizens into a library and a context; the card and census helpers render browse and census output for both citizens and explicit non-citizen exemptions; and a reference citizen value is provided as an example.
§Explicit registration
Inventory-backed discovery is convenient for normal host binaries. Strict
release, LTO, and wasm checks can instead build a CitizenRegistry by
calling CitizenRegistry::register for each expected citizen type, load
that registry as a kernel library, and call
run_registry_conformance_expecting. The expected-symbol guard reports a
missing row instead of letting a shorter registry pass.
Re-exports§
pub use ::inventory;
Structs§
- Citizen
Info - One inventory-registered citizen’s static registry row.
- Citizen
Lib - A kernel
Libthat loads registered citizens into a context. - Citizen
Registry - An explicit citizen registry built by naming the citizen types a crate owns.
- NonCitizen
Info - One inventory-registered explicit non-citizen exemption.
Traits§
- Citizen
- Static citizen identity: the metadata
#[derive(Citizen)]supplies. - Citizen
Eq - Semantic equality between citizen field values for the strict gate.
- Citizen
Field - Encodes and decodes a Rust type as one citizen constructor field.
- Citizen
Runtime - A fully runnable citizen: identity plus kernel object and read-construct.
Functions§
- arity_
error - Builds the standard error for a wrong read-constructor argument count.
- check_
default_ fixture - Checks the citizen’s default
CitizenRuntime::examplefixture round trip. - check_
fixture - Checks one runtime fixture’s read-construct round trip and failure paths.
- check_
value_ fixture - Checks an already-built citizen
Value’s read-construct round trip. - check_
value_ fixture_ with_ wrong_ version - Asserts the full citizen read-construct contract for one value.
- citizen_
card - Builds the browse Card record for one registered citizen.
- citizen_
census_ markdown - Renders the full census of inventory-registered citizens as Markdown.
- citizen_
registry_ census_ markdown - Renders the supplied explicit registry’s citizens as Markdown.
- constructor_
expr - Encodes a citizen value as its read-construct
Exprextension form. - decode_
version - Checks that a citizen’s version argument equals the
expectedversion. - expr_
citizen_ eq - Compares two
Exprs under citizen equality. - field_
error - Builds a
citizen field <field>: <message>evaluation error. - install_
all - Installs every registered citizen’s class into
linker. - install_
derived - Installs a derived citizen
Tas a class value inlinker. - install_
namespace - Installs only the registered citizens whose symbol is in
namespace. - non_
citizen_ card - Builds the browse Card record (a
coretable) for one non-citizen exemption. - non_
citizen_ census_ markdown - Renders the full census of inventory-registered non-citizen exemptions as Markdown.
- parse_
symbol - Parses
namespace/nametext into a kernelSymbol. - registered_
citizens - Iterates every
CitizenInforegistered throughinventory. - registered_
non_ citizens - Iterates every
NonCitizenInforegistered throughinventory. - render_
citizen_ census - Renders the supplied citizen rows as a generated Markdown census table.
- render_
non_ citizen_ census - Renders the supplied non-citizen exemption rows as a generated Markdown census table.
- run_
registered_ conformance - Loads every registered citizen and runs each citizen’s conformance fixture.
- run_
registered_ conformance_ expecting - Runs inventory-backed conformance after checking expected symbols.
- run_
registry_ conformance - Loads an explicit registry and runs each row’s conformance fixture.
- run_
registry_ conformance_ expecting - Runs explicit-registry conformance after checking expected symbols.
- text_
read_ construct_ expr - Builds the
citizen/read-constructExprfor av1text citizen form. - value_
from_ expr - Builds a runtime
Valuefrom anExprusingcx’s factory. - value_
to_ expr - Projects a runtime
Valueto anExpr, tagging errors withfield. - values_
citizen_ eq - Compares two citizen
Values for semantic equality.