pub struct Registry { /* private fields */ }Expand description
Registry for managing all structures in polyscope.
Structures are organized by type name and then by instance name.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn register(&mut self, structure: Box<dyn Structure>) -> Result<()>
pub fn register(&mut self, structure: Box<dyn Structure>) -> Result<()>
Registers a structure with the registry.
Returns an error if a structure with the same type and name already exists.
Sourcepub fn get(&self, type_name: &str, name: &str) -> Option<&dyn Structure>
pub fn get(&self, type_name: &str, name: &str) -> Option<&dyn Structure>
Gets a reference to a structure by type and name.
Sourcepub fn get_mut(
&mut self,
type_name: &str,
name: &str,
) -> Option<&mut Box<dyn Structure>>
pub fn get_mut( &mut self, type_name: &str, name: &str, ) -> Option<&mut Box<dyn Structure>>
Gets a mutable reference to a structure by type and name.
Sourcepub fn contains(&self, type_name: &str, name: &str) -> bool
pub fn contains(&self, type_name: &str, name: &str) -> bool
Checks if a structure with the given type and name exists.
Sourcepub fn remove(
&mut self,
type_name: &str,
name: &str,
) -> Option<Box<dyn Structure>>
pub fn remove( &mut self, type_name: &str, name: &str, ) -> Option<Box<dyn Structure>>
Removes a structure by type and name.
Sourcepub fn remove_all_of_type(&mut self, type_name: &str)
pub fn remove_all_of_type(&mut self, type_name: &str)
Removes all structures of a given type.
Sourcepub fn iter(&self) -> impl Iterator<Item = &dyn Structure>
pub fn iter(&self) -> impl Iterator<Item = &dyn Structure>
Returns an iterator over all structures.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Box<dyn Structure>> + '_
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Box<dyn Structure>> + '_
Returns a mutable iterator over all structures.
Sourcepub fn get_all_of_type(
&self,
type_name: &str,
) -> impl Iterator<Item = &dyn Structure>
pub fn get_all_of_type( &self, type_name: &str, ) -> impl Iterator<Item = &dyn Structure>
Returns all structures of a given type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl !UnwindSafe for Registry
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