pub struct WasmExtensionManager { /* private fields */ }Expand description
Manages WASM extensions: discovery, loading, and tool execution.
§Thread Safety
plugins is wrapped in Arc<Mutex<>> for exclusive thread-safe access.
All host functions run inside spawn_blocking, so WASM execution
never blocks the async runtime.
Implementations§
Source§impl WasmExtensionManager
impl WasmExtensionManager
Sourcepub fn with_http_client(client: Client) -> Self
pub fn with_http_client(client: Client) -> Self
Create with a custom HTTP client (useful for testing with a mock client).
Sourcepub fn discover(cwd: &Path) -> Vec<PathBuf>
pub fn discover(cwd: &Path) -> Vec<PathBuf>
Discover .wasm files in standard extension directories.
Sourcepub fn load(&mut self, path: &Path) -> Result<ExtensionInfo>
pub fn load(&mut self, path: &Path) -> Result<ExtensionInfo>
Load a single .wasm extension.
Sourcepub fn load_all(
&mut self,
paths: &[PathBuf],
) -> (Vec<ExtensionInfo>, Vec<Error>)
pub fn load_all( &mut self, paths: &[PathBuf], ) -> (Vec<ExtensionInfo>, Vec<Error>)
Load all discovered extensions, collecting errors.
Sourcepub fn execute_tool(&self, tool_name: &str, params: Value) -> Result<Value>
pub fn execute_tool(&self, tool_name: &str, params: Value) -> Result<Value>
Execute a tool via the WASM extension.
Sourcepub fn all_tool_defs(&self) -> Vec<&WasmToolDef>
pub fn all_tool_defs(&self) -> Vec<&WasmToolDef>
Get all tool definitions from all loaded extensions.
Sourcepub fn is_wasm_tool(&self, tool_name: &str) -> bool
pub fn is_wasm_tool(&self, tool_name: &str) -> bool
Check if a tool name belongs to a WASM extension.
Sourcepub fn extension_names(&self) -> impl Iterator<Item = &str>
pub fn extension_names(&self) -> impl Iterator<Item = &str>
List loaded extension names.
Sourcepub fn get_info(&self, name: &str) -> Option<&ExtensionInfo>
pub fn get_info(&self, name: &str) -> Option<&ExtensionInfo>
Get extension info by name.
Sourcepub fn all_command_defs(&self) -> Vec<(&str, &WasmCommandDef)>
pub fn all_command_defs(&self) -> Vec<(&str, &WasmCommandDef)>
Get all command definitions from all loaded extensions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WasmExtensionManager
impl !RefUnwindSafe for WasmExtensionManager
impl Send for WasmExtensionManager
impl Sync for WasmExtensionManager
impl Unpin for WasmExtensionManager
impl UnsafeUnpin for WasmExtensionManager
impl !UnwindSafe for WasmExtensionManager
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