pub struct RoleRegistry { /* private fields */ }Expand description
String-keyed so custom roles (beyond the 10 built-ins) are accepted, just
like omp’s modelRoles: Record<string, string>.
Implementations§
Source§impl RoleRegistry
impl RoleRegistry
Sourcepub fn new() -> RoleRegistry
pub fn new() -> RoleRegistry
Create an empty registry.
Sourcepub fn from_map(roles: HashMap<String, String>) -> RoleRegistry
pub fn from_map(roles: HashMap<String, String>) -> RoleRegistry
Build a registry from a role → pattern map (e.g. parsed from settings).
Sourcepub fn set(&mut self, role: impl Into<String>, model: impl Into<String>)
pub fn set(&mut self, role: impl Into<String>, model: impl Into<String>)
Assign a model pattern to a role.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &String)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &String)>
Iterate over (role, pattern) pairs.
Sourcepub fn known_ids(&self) -> Vec<String>
pub fn known_ids(&self) -> Vec<String>
Known role ids: visible built-ins first (in declaration order), then
any configured custom roles sorted by name — ported from omp’s
getKnownRoleIds.
Sourcepub fn resolve(&self, role: &str) -> Vec<String>
pub fn resolve(&self, role: &str) -> Vec<String>
Resolve a role to concrete model pattern(s), expanding pi/<role>
aliases with cycle detection. Ported from omp’s
resolveConfiguredRolePattern.
- A directly-configured role yields its (alias-expanded) patterns.
- An unset
smol/slow/designerinherits thedefaultrole’s patterns (which themselves may alias another role). - Self-aliases (
default = "pi/default") collapse to the built-in default chain (empty in oxicode — seeSelf::builtin_defaults). - A cycle (
a → pi/b,b → pi/a) terminates, returning what resolved before the cycle closed. - An entirely unset role with no inheritance returns an empty vec.
Sourcepub fn builtin_defaults(&self, _role: &str) -> Vec<String>
pub fn builtin_defaults(&self, _role: &str) -> Vec<String>
Built-in default model chain for a role.
omp seeds these from MODEL_PRIO (omp-catalog ids). oxicode returns an
empty list: the switching layer (deferred) fills defaults via oxicode’s
own catalog / FallbackChain. This keeps the machinery faithful
without embedding ids that don’t exist in oxicode.
Trait Implementations§
Source§impl Clone for RoleRegistry
impl Clone for RoleRegistry
Source§fn clone(&self) -> RoleRegistry
fn clone(&self) -> RoleRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more