pub struct ShapeRegistry { /* private fields */ }Expand description
Registry mapping shape IDs to their ObjectShape definitions.
Supports two modes:
- Builder mode (
base=None): wraps a single HashMap, used duringbuild_builtin_shapes/build_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 ShapeRegistry
impl ShapeRegistry
Sourcepub fn with_base(base: &'static HashMap<String, ObjectShape>) -> Self
pub fn with_base(base: &'static HashMap<String, ObjectShape>) -> Self
Create an overlay-mode registry backed by a static base.
pub fn get(&self, key: &str) -> Option<&ObjectShape>
pub fn insert(&mut self, key: String, value: ObjectShape)
Sourcepub fn into_inner(self) -> HashMap<String, ObjectShape>
pub fn into_inner(self) -> HashMap<String, ObjectShape>
Consume the registry and return the inner HashMap. Only valid in builder mode (no base).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShapeRegistry
impl RefUnwindSafe for ShapeRegistry
impl Send for ShapeRegistry
impl Sync for ShapeRegistry
impl Unpin for ShapeRegistry
impl UnsafeUnpin for ShapeRegistry
impl UnwindSafe for ShapeRegistry
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