pub struct Registry {
pub schema_hash: String,
pub kinds: Vec<Kind>,
pub queries: Vec<QueryDecl>,
pub roles: Vec<RoleDecl>,
}Expand description
Everything the engine may know about a KB’s shapes.
Fields§
§schema_hash: StringHash of the schema crate’s source — accept checks freshness against it.
kinds: Vec<Kind>§queries: Vec<QueryDecl>Schema-authored analytical queries. The schema constructs these through the typed builder; this committed representation is backend-neutral and can be rendered by the web UI without parsing Rust.
roles: Vec<RoleDecl>This KB’s role vocabulary — flat, declared once, adoptable by any
kind (a Field’s role names one). Universal for THIS KB, invisible
to every other: the KB’s words, mapped onto engine affordances.
Implementations§
Source§impl Registry
impl Registry
pub fn role(&self, name: &str) -> Option<&RoleDecl>
Sourcepub fn binds(&self, field: &Field) -> Option<Affordance>
pub fn binds(&self, field: &Field) -> Option<Affordance>
The engine affordance a field’s adopted role binds, if any.
Sourcepub fn affordance_field<'a>(
&self,
kind: &'a Kind,
a: Affordance,
) -> Option<&'a Field>
pub fn affordance_field<'a>( &self, kind: &'a Kind, a: Affordance, ) -> Option<&'a Field>
The field of kind bound to affordance, if any.
Sourcepub fn coherence_errors(&self) -> Vec<String>
pub fn coherence_errors(&self) -> Vec<String>
STRICT role coherence — an incoherent mapping makes the registry meaningless, so these are hard errors wherever a registry is loaded or generated: every adopted role is declared; the field’s shape fits the affordance (Title = str, Timeline = date, Badge = enum); a Badge role’s shared variants match the adopting field’s enum EXACTLY. A kind wanting different vocabulary declares its own enum field and simply doesn’t adopt the role.
Sourcepub fn query_errors(&self) -> Vec<String>
pub fn query_errors(&self) -> Vec<String>
Bind every emitted query back against this registry. Typed Rust catches mistakes at the authoring call site; this second gate protects the serialized artifact from drift or hand edits.