pub struct PluginManager { /* private fields */ }Expand description
Manages the lifecycle of all loaded plugins for a session.
Each session owns its own PluginManager; plugins are not shared across
sessions so that sessions can have different capability sets.
Implementations§
Source§impl PluginManager
impl PluginManager
pub fn new() -> Self
Sourcepub fn register(&mut self, plugin: impl Plugin + 'static)
pub fn register(&mut self, plugin: impl Plugin + 'static)
Register a plugin. Does not load it yet.
Sourcepub fn register_arc(&mut self, plugin: Arc<dyn Plugin>)
pub fn register_arc(&mut self, plugin: Arc<dyn Plugin>)
Register a pre-boxed plugin.
Sourcepub fn load_all(&self, registry: &Arc<ToolRegistry>, ctx: &PluginContext)
pub fn load_all(&self, registry: &Arc<ToolRegistry>, ctx: &PluginContext)
Load all registered plugins into registry.
Plugins are loaded in registration order. If a plugin fails to load, the error is logged and loading continues for the remaining plugins.
On a successful load, the plugin’s companion skills (from Plugin::skills)
are registered into ctx.skill_registry when one is provided.
Sourcepub fn unload(&mut self, name: &str, registry: &Arc<ToolRegistry>)
pub fn unload(&mut self, name: &str, registry: &Arc<ToolRegistry>)
Unload a single plugin by name.
Removes the plugin’s tools from the registry and deregisters the plugin.
Sourcepub fn unload_all(&mut self, registry: &Arc<ToolRegistry>)
pub fn unload_all(&mut self, registry: &Arc<ToolRegistry>)
Unload all plugins.
Sourcepub fn plugin_names(&self) -> Vec<&str>
pub fn plugin_names(&self) -> Vec<&str>
List all registered plugin names.
Trait Implementations§
Source§impl Default for PluginManager
impl Default for PluginManager
Source§fn default() -> PluginManager
fn default() -> PluginManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PluginManager
impl !RefUnwindSafe for PluginManager
impl Send for PluginManager
impl Sync for PluginManager
impl Unpin for PluginManager
impl UnsafeUnpin for PluginManager
impl !UnwindSafe for PluginManager
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