pub struct PluginHost { /* private fields */ }Expand description
Plugin host that manages Wasm plugins
Implementations§
Source§impl PluginHost
impl PluginHost
Sourcepub fn with_default_dir() -> Self
pub fn with_default_dir() -> Self
Create with default plugin directory (~/.rx/plugins)
Sourcepub fn set_default_permissions(&mut self, permissions: PluginPermissions)
pub fn set_default_permissions(&mut self, permissions: PluginPermissions)
Set default permissions for plugins
Sourcepub fn plugin_dir(&self) -> &Path
pub fn plugin_dir(&self) -> &Path
Get the plugin directory
Sourcepub fn ensure_plugin_dir(&self) -> PluginResult<()>
pub fn ensure_plugin_dir(&self) -> PluginResult<()>
Ensure plugin directory exists
Sourcepub fn load(&mut self, name: &str, wasm_path: &Path) -> PluginResult<()>
pub fn load(&mut self, name: &str, wasm_path: &Path) -> PluginResult<()>
Load a plugin from a Wasm file
Sourcepub fn load_with_config(
&mut self,
name: &str,
wasm_path: &Path,
config: Option<PluginConfig>,
) -> PluginResult<()>
pub fn load_with_config( &mut self, name: &str, wasm_path: &Path, config: Option<PluginConfig>, ) -> PluginResult<()>
Load a plugin with specific configuration
Sourcepub fn load_from_dir(&mut self, dir: &Path) -> PluginResult<usize>
pub fn load_from_dir(&mut self, dir: &Path) -> PluginResult<usize>
Load all plugins from a directory
Sourcepub fn load_from_config(
&mut self,
configs: &HashMap<String, PluginConfig>,
) -> PluginResult<usize>
pub fn load_from_config( &mut self, configs: &HashMap<String, PluginConfig>, ) -> PluginResult<usize>
Load plugins from pyproject.toml configuration
Sourcepub fn execute_hook(
&mut self,
hook: Hook,
context: &HookContext,
) -> PluginResult<HookResult>
pub fn execute_hook( &mut self, hook: Hook, context: &HookContext, ) -> PluginResult<HookResult>
Execute a hook on all enabled plugins that implement it
Sourcepub fn plugin_count(&self) -> usize
pub fn plugin_count(&self) -> usize
Get the number of loaded plugins
Sourcepub fn enabled_count(&self) -> usize
pub fn enabled_count(&self) -> usize
Get the number of enabled plugins
Sourcepub fn list_plugins(&self) -> Vec<&LoadedPlugin>
pub fn list_plugins(&self) -> Vec<&LoadedPlugin>
List all loaded plugins
Sourcepub fn get_plugin(&self, name: &str) -> Option<&LoadedPlugin>
pub fn get_plugin(&self, name: &str) -> Option<&LoadedPlugin>
Get a plugin by name
Sourcepub fn remove_plugin(&mut self, name: &str) -> bool
pub fn remove_plugin(&mut self, name: &str) -> bool
Remove a plugin by name
Sourcepub fn enable_plugin(&mut self, name: &str) -> bool
pub fn enable_plugin(&mut self, name: &str) -> bool
Enable a plugin
Sourcepub fn disable_plugin(&mut self, name: &str) -> bool
pub fn disable_plugin(&mut self, name: &str) -> bool
Disable a plugin
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PluginHost
impl !RefUnwindSafe for PluginHost
impl Send for PluginHost
impl Sync for PluginHost
impl Unpin for PluginHost
impl !UnwindSafe for PluginHost
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