pub struct GlobalRegistry { /* private fields */ }Expand description
Registry mapping global names to their types.
Supports two modes:
- Builder mode (
base=None): wraps a single HashMap, used duringbuild_default_globalsto construct the static base. - Overlay mode (
base=Some): holds a&'static HashMapbase plus a small extras HashMap. Lookups check extras first, then base. Inserts go into extras. Cloning only copies the extras map (the base pointer is shared).
Implementations§
Source§impl GlobalRegistry
impl GlobalRegistry
Sourcepub fn with_base(base: &'static HashMap<String, Global>) -> Self
pub fn with_base(base: &'static HashMap<String, Global>) -> Self
Create an overlay-mode registry backed by a static base.
pub fn get(&self, key: &str) -> Option<&Global>
pub fn insert(&mut self, key: String, value: Global)
pub fn contains_key(&self, key: &str) -> bool
Sourcepub fn keys(&self) -> impl Iterator<Item = &String>
pub fn keys(&self) -> impl Iterator<Item = &String>
Iterate over all keys in the registry (base + extras). Keys in extras that shadow base keys appear only once.
Sourcepub fn into_inner(self) -> HashMap<String, Global>
pub fn into_inner(self) -> HashMap<String, Global>
Consume the registry and return the inner HashMap. Only valid in builder mode (no base).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GlobalRegistry
impl RefUnwindSafe for GlobalRegistry
impl Send for GlobalRegistry
impl Sync for GlobalRegistry
impl Unpin for GlobalRegistry
impl UnsafeUnpin for GlobalRegistry
impl UnwindSafe for GlobalRegistry
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
Mutably borrows from an owned value. Read more