pub struct WasmPackageHost { /* private fields */ }Expand description
Manages loaded Extism WASM packages.
Implementations§
Source§impl WasmPackageHost
impl WasmPackageHost
Sourcepub fn new(load_infos: &[PackageLoadInfo], host_state: WasmHostState) -> Self
pub fn new(load_infos: &[PackageLoadInfo], host_state: WasmHostState) -> Self
Load all WASM packages with shared host state.
pub fn call_isolated( &self, package_name: &str, func: &str, input: &str, ) -> Result<String>
Sourcepub fn load_package(&mut self, info: &PackageLoadInfo) -> Result<()>
pub fn load_package(&mut self, info: &PackageLoadInfo) -> Result<()>
Dynamically load a single plugin. Calls init() after loading.
Sourcepub fn unload_package(&mut self, name: &str) -> Result<()>
pub fn unload_package(&mut self, name: &str) -> Result<()>
Unload a package by name. The WASM resources are freed on drop.
Sourcepub fn reload_package(&mut self, info: &PackageLoadInfo) -> Result<()>
pub fn reload_package(&mut self, info: &PackageLoadInfo) -> Result<()>
Reload a plugin: unload then load from the same path.
Sourcepub fn call(
&self,
package_name: &str,
func: &str,
input: &str,
) -> Result<String>
pub fn call( &self, package_name: &str, func: &str, input: &str, ) -> Result<String>
Call an exported function on a named plugin.
Sourcepub fn has_package(&self, name: &str) -> bool
pub fn has_package(&self, name: &str) -> bool
Check if a package is loaded.
Sourcepub fn package_names(&self) -> Vec<String>
pub fn package_names(&self) -> Vec<String>
List loaded package names.
Sourcepub fn kv_set(&self, key: &str, value: &str)
pub fn kv_set(&self, key: &str, value: &str)
Write a value into the shared KV store (same store WASM packages read via host_kv_get). Lets the API layer push runtime state (e.g. team:role_routing on scene activation) without going through a WASM call.
pub fn set_app_state(&mut self, app_state: AppState)
Auto Trait Implementations§
impl !RefUnwindSafe for WasmPackageHost
impl !UnwindSafe for WasmPackageHost
impl Freeze for WasmPackageHost
impl Send for WasmPackageHost
impl Sync for WasmPackageHost
impl Unpin for WasmPackageHost
impl UnsafeUnpin for WasmPackageHost
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
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: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + 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