pub struct PluginRegistry { /* private fields */ }Expand description
A thread-safe registry for managing loaded plugins
Implementations§
Source§impl PluginRegistry
impl PluginRegistry
Sourcepub fn new() -> Result<Self, LoaderError>
pub fn new() -> Result<Self, LoaderError>
Create a new empty plugin registry
Sourcepub fn with_loader(loader: PluginLoader) -> Self
pub fn with_loader(loader: PluginLoader) -> Self
Create with an existing loader
Sourcepub fn with_permissions(config: PermissionConfig) -> Result<Self, LoaderError>
pub fn with_permissions(config: PermissionConfig) -> Result<Self, LoaderError>
Create with permission configuration
When permission config is set, the registry will check plugin capabilities before execution and prompt users as needed.
Sourcepub fn set_permissions(&mut self, config: PermissionConfig)
pub fn set_permissions(&mut self, config: PermissionConfig)
Add permission configuration to an existing registry
Sourcepub async fn load_plugin(
&self,
path: impl AsRef<Path>,
) -> Result<String, LoaderError>
pub async fn load_plugin( &self, path: impl AsRef<Path>, ) -> Result<String, LoaderError>
Load and register a plugin from a file path
Sourcepub async fn register(&self, plugin: LoadedPlugin) -> String
pub async fn register(&self, plugin: LoadedPlugin) -> String
Register a pre-loaded plugin (without file path tracking)
Sourcepub async fn unload_by_path(&self, path: impl AsRef<Path>) -> Option<String>
pub async fn unload_by_path(&self, path: impl AsRef<Path>) -> Option<String>
Unload a plugin by file path
Sourcepub async fn reload_by_path(
&self,
path: impl AsRef<Path>,
) -> Result<String, LoaderError>
pub async fn reload_by_path( &self, path: impl AsRef<Path>, ) -> Result<String, LoaderError>
Reload a plugin from its source path
Sourcepub async fn list_commands(&self) -> Vec<String>
pub async fn list_commands(&self) -> Vec<String>
Get a list of all registered command names
Sourcepub async fn has_command(&self, command_name: &str) -> bool
pub async fn has_command(&self, command_name: &str) -> bool
Check if a command exists
Sourcepub async fn execute(
&self,
command_name: &str,
args: &[String],
) -> Result<ExecuteResult, RegistryError>
pub async fn execute( &self, command_name: &str, args: &[String], ) -> Result<ExecuteResult, RegistryError>
Execute a plugin command
If permission configuration is set, this will:
- Check stored permissions for the plugin
- Apply the permission strategy to decide allow/deny/prompt
- Prompt the user if needed (for interactive mode)
- Record audit events
- Execute the plugin if permitted
Sourcepub async fn get_manifest(&self, command_name: &str) -> Option<PluginManifest>
pub async fn get_manifest(&self, command_name: &str) -> Option<PluginManifest>
Get plugin manifest for a command
Sourcepub async fn get_all_manifests(&self) -> Vec<PluginManifest>
pub async fn get_all_manifests(&self) -> Vec<PluginManifest>
Get all plugin manifests
Trait Implementations§
Source§impl Clone for PluginRegistry
impl Clone for PluginRegistry
Source§fn clone(&self) -> PluginRegistry
fn clone(&self) -> PluginRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PluginRegistry
impl !RefUnwindSafe for PluginRegistry
impl Send for PluginRegistry
impl Sync for PluginRegistry
impl Unpin for PluginRegistry
impl !UnwindSafe for PluginRegistry
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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