pub struct PluginManager { /* private fields */ }Expand description
Manager for all plugin runtimes and loaded plugins.
Implementations§
Source§impl PluginManager
impl PluginManager
Sourcepub fn new(config: PluginConfig) -> Self
pub fn new(config: PluginConfig) -> Self
Create a new plugin manager with the given configuration.
Sourcepub fn register_runtime(
&mut self,
runtime: Box<dyn PluginRuntime>,
) -> PluginResult<()>
pub fn register_runtime( &mut self, runtime: Box<dyn PluginRuntime>, ) -> PluginResult<()>
Register a plugin runtime.
Sourcepub fn get_runtime(&self, name: &str) -> Option<&dyn PluginRuntime>
pub fn get_runtime(&self, name: &str) -> Option<&dyn PluginRuntime>
Get a runtime by name.
Sourcepub fn get_runtime_mut(
&mut self,
name: &str,
) -> Option<&mut Box<dyn PluginRuntime>>
pub fn get_runtime_mut( &mut self, name: &str, ) -> Option<&mut Box<dyn PluginRuntime>>
Get a mutable runtime by name.
Sourcepub fn init_runtimes(&mut self) -> PluginResult<()>
pub fn init_runtimes(&mut self) -> PluginResult<()>
Initialize all registered runtimes.
Sourcepub async fn discover_plugins(&mut self) -> PluginResult<Vec<LoadedPlugin>>
pub async fn discover_plugins(&mut self) -> PluginResult<Vec<LoadedPlugin>>
Discover and load plugins from the plugin directory.
Sourcepub fn load_plugin(&mut self, path: &Path) -> PluginResult<LoadedPlugin>
pub fn load_plugin(&mut self, path: &Path) -> PluginResult<LoadedPlugin>
Load a single plugin from a path.
Sourcepub fn unload_plugin(&mut self, handle: PluginHandle) -> PluginResult<()>
pub fn unload_plugin(&mut self, handle: PluginHandle) -> PluginResult<()>
Unload a plugin.
Sourcepub async fn dispatch_hook(
&self,
hook: &Hook,
ctx: &HookContext,
) -> Vec<HookResult>
pub async fn dispatch_hook( &self, hook: &Hook, ctx: &HookContext, ) -> Vec<HookResult>
Dispatch a hook to all plugins that implement it.
Sourcepub fn get_plugin(&self, handle: PluginHandle) -> Option<&LoadedPlugin>
pub fn get_plugin(&self, handle: PluginHandle) -> Option<&LoadedPlugin>
Get a loaded plugin by handle.
Sourcepub fn plugins_of_kind(
&self,
kind: PluginKind,
) -> impl Iterator<Item = &LoadedPlugin>
pub fn plugins_of_kind( &self, kind: PluginKind, ) -> impl Iterator<Item = &LoadedPlugin>
Get plugins of a specific kind.
Sourcepub fn shutdown(&mut self) -> PluginResult<()>
pub fn shutdown(&mut self) -> PluginResult<()>
Shutdown all runtimes.
Trait Implementations§
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
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more