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 moreSource§impl Debug for RoleRegistry
impl Debug for RoleRegistry
Source§impl Default for RoleRegistry
impl Default for RoleRegistry
Source§fn default() -> RoleRegistry
fn default() -> RoleRegistry
Auto Trait Implementations§
impl Freeze for RoleRegistry
impl RefUnwindSafe for RoleRegistry
impl Send for RoleRegistry
impl Sync for RoleRegistry
impl Unpin for RoleRegistry
impl UnsafeUnpin for RoleRegistry
impl UnwindSafe for RoleRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.