pub struct SystemRegistry { /* private fields */ }Expand description
An extensible set of SystemDefs. Seeded with the 17 built-in systems; register adds/refines
more. Lookups are by id (and by human label, for importing label-keyed knowledge files). Cloneable
and serialisable so an app can persist / ship an extended taxonomy.
Implementations§
Source§impl SystemRegistry
impl SystemRegistry
Sourcepub fn new_empty() -> Self
pub fn new_empty() -> Self
An empty registry (no systems). Use SystemRegistry::seed for the built-in 17.
Sourcepub fn seed() -> Self
pub fn seed() -> Self
The built-in seed: the 17 systems from BODY_SYSTEMS, each enriched with its representation
and overlay hosts (from super::model) and a default identity colour. Provenance = Seed.
Sourcepub fn register(&mut self, def: SystemDef) -> &mut Self
pub fn register(&mut self, def: SystemDef) -> &mut Self
Register (or refine) a system. If a system with the same id already exists it is replaced —
a later, more-authoritative definition (e.g. an ontology pack) may correct a seed’s label/colour.
Returns &mut Self for chaining.
Sourcepub fn get_by_label(&self, label: &str) -> Option<&SystemDef>
pub fn get_by_label(&self, label: &str) -> Option<&SystemDef>
Look up a system by its human label (case-insensitive, trimmed) — for importing label-keyed
knowledge files (e.g. condition-map.json keys systems by "Endocrine System").
Sourcepub fn all(&self) -> &[SystemDef]
pub fn all(&self) -> &[SystemDef]
All registered systems, in registration order (the 17 seed order first).
Sourcepub fn label_for(&self, id: &str) -> String
pub fn label_for(&self, id: &str) -> String
The human label for a system id, or the id itself if unregistered (so nothing renders blank).
Sourcepub fn plain_label_for(&self, id: &str) -> String
pub fn plain_label_for(&self, id: &str) -> String
The plain-language label for a system id, or the id itself if unregistered.
Sourcepub fn representation_of(&self, id: &str) -> SystemRepresentation
pub fn representation_of(&self, id: &str) -> SystemRepresentation
How a system is rendered — defaults to SystemRepresentation::DiscreteOrgans for an
unregistered id (the safe default: try to paint an organ mesh if one turns up).
Sourcepub fn overlay_hosts_of(&self, id: &str) -> &[String]
pub fn overlay_hosts_of(&self, id: &str) -> &[String]
The overlay host system ids for a distributed system (empty for discrete or unregistered).
Sourcepub fn color_of(&self, id: &str) -> [f32; 4]
pub fn color_of(&self, id: &str) -> [f32; 4]
The default identity colour for a system id, or NEUTRAL_SYSTEM_RGBA if unregistered.
Sourcepub fn canonical_majors(&self) -> impl Iterator<Item = &SystemDef>
pub fn canonical_majors(&self) -> impl Iterator<Item = &SystemDef>
The canonical major organ systems (the classic 11 in the seed).
Sourcepub fn sub_systems_of(
&self,
parent_id: &str,
) -> impl Iterator<Item = &SystemDef>
pub fn sub_systems_of( &self, parent_id: &str, ) -> impl Iterator<Item = &SystemDef>
The direct sub-systems of parent_id (e.g. nervous → sensory / vestibular / ENS / glymphatic).
Sourcepub fn relations_of(&self, id: &str) -> &[SystemRelation]
pub fn relations_of(&self, id: &str) -> &[SystemRelation]
A system’s structural links to other systems (empty for unregistered or unlinked systems).