pub struct PluginRegistry<T: Plugin + ?Sized> { /* private fields */ }Expand description
A type-safe registry that stores and retrieves plugin instances by name.
T is typically a trait object such as dyn Plugin, dyn ScalarFunction,
or any other extension trait.
Implementations§
Source§impl<T: Plugin + ?Sized> PluginRegistry<T>
impl<T: Plugin + ?Sized> PluginRegistry<T>
Sourcepub fn register(&mut self, plugin: Box<T>) -> Result<(), CypherLiteError>
pub fn register(&mut self, plugin: Box<T>) -> Result<(), CypherLiteError>
Register a plugin. Returns an error if a plugin with the same name is already registered.
Sourcepub fn get_mut(&mut self, name: &str) -> Option<&mut T>
pub fn get_mut(&mut self, name: &str) -> Option<&mut T>
Get a mutable reference to a plugin by name.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for PluginRegistry<T>where
T: ?Sized,
impl<T> RefUnwindSafe for PluginRegistry<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for PluginRegistry<T>where
T: ?Sized,
impl<T> Sync for PluginRegistry<T>where
T: ?Sized,
impl<T> Unpin for PluginRegistry<T>where
T: ?Sized,
impl<T> UnsafeUnpin for PluginRegistry<T>where
T: ?Sized,
impl<T> UnwindSafe for PluginRegistry<T>where
T: UnwindSafe + ?Sized,
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