pub struct PluginManager { /* private fields */ }Expand description
Manages WASM plugins loaded from disk.
Plugins are discovered from ~/.config/mneme/plugins/*.wasm at startup.
Each plugin is sandboxed and communicates via JSON over the extism ABI.
Implementations§
Source§impl PluginManager
impl PluginManager
Sourcepub fn load_from_default_dir() -> Result<Self>
pub fn load_from_default_dir() -> Result<Self>
Discover and load plugins from the default directory:
~/.config/mneme/plugins/*.wasm
Sourcepub fn load_from_dir(dir: &Path) -> Result<Self>
pub fn load_from_dir(dir: &Path) -> Result<Self>
Load plugins from an explicit directory (useful for tests).
Sourcepub fn plugin_tools(&self) -> Vec<PluginTool>
pub fn plugin_tools(&self) -> Vec<PluginTool>
All tools provided by loaded plugins.
Sourcepub fn owns_tool(&self, tool_name: &str) -> bool
pub fn owns_tool(&self, tool_name: &str) -> bool
Returns true if the given tool name belongs to any loaded plugin.
Sourcepub fn call_tool(
&self,
tool_name: &str,
args: Value,
project: &str,
) -> Result<Value>
pub fn call_tool( &self, tool_name: &str, args: Value, project: &str, ) -> Result<Value>
Dispatch a tool call to the plugin that owns it.
Returns MnemeError::Plugin if no plugin owns the tool.
Sourcepub fn run_pre_save(&self, memory: Value) -> Result<Value>
pub fn run_pre_save(&self, memory: Value) -> Result<Value>
Run the pre_save hook through all plugins that declare it.
Plugins are chained: the output of one becomes the input of the next.
Sourcepub fn run_post_get(&self, memory: Value) -> Result<Value>
pub fn run_post_get(&self, memory: Value) -> Result<Value>
Run the post_get hook through all plugins that declare it.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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