Struct proto::PluginContainer
pub struct PluginContainer<'plugin> {
pub id: Id,
pub manifest: Manifest,
/* private fields */
}Expand description
A container around Extism’s [Plugin] and [Manifest] types that provides convenience
methods for calling and caching functions from the WASM plugin. It also provides
additional methods for easily working with WASI and virtual paths.
Fields§
§id: Id§manifest: ManifestImplementations§
§impl<'plugin> PluginContainer<'plugin>
impl<'plugin> PluginContainer<'plugin>
pub fn new<'new>(
id: Id,
manifest: Manifest,
functions: impl IntoIterator<Item = Function>
) -> Result<PluginContainer<'new>, Report>
pub fn new<'new>( id: Id, manifest: Manifest, functions: impl IntoIterator<Item = Function> ) -> Result<PluginContainer<'new>, Report>
Create a new container with the provided manifest and host functions.
pub fn new_without_functions<'new>(
id: Id,
manifest: Manifest
) -> Result<PluginContainer<'new>, Report>
pub fn new_without_functions<'new>( id: Id, manifest: Manifest ) -> Result<PluginContainer<'new>, Report>
Create a new container with the provided manifest.
pub fn cache_func<O>(&self, func: &str) -> Result<O, Report>where
O: Debug + DeserializeOwned,
pub fn cache_func<O>(&self, func: &str) -> Result<O, Report>where O: Debug + DeserializeOwned,
Call a function on the plugin with no input and cache the output before returning it. Subsequent calls will read from the cache.
pub fn cache_func_with<I, O>(&self, func: &str, input: I) -> Result<O, Report>where
I: Debug + Serialize,
O: Debug + DeserializeOwned,
pub fn cache_func_with<I, O>(&self, func: &str, input: I) -> Result<O, Report>where I: Debug + Serialize, O: Debug + DeserializeOwned,
Call a function on the plugin with the given input and cache the output before returning it. Subsequent calls with the same input will read from the cache.
pub fn call_func<O>(&self, func: &str) -> Result<O, Report>where
O: Debug + DeserializeOwned,
pub fn call_func<O>(&self, func: &str) -> Result<O, Report>where O: Debug + DeserializeOwned,
Call a function on the plugin with no input and return the output.
pub fn call_func_with<I, O>(&self, func: &str, input: I) -> Result<O, Report>where
I: Debug + Serialize,
O: Debug + DeserializeOwned,
pub fn call_func_with<I, O>(&self, func: &str, input: I) -> Result<O, Report>where I: Debug + Serialize, O: Debug + DeserializeOwned,
Call a function on the plugin with the given input and return the output.
pub fn call_func_without_output<I>(
&self,
func: &str,
input: I
) -> Result<(), Report>where
I: Debug + Serialize,
pub fn call_func_without_output<I>( &self, func: &str, input: I ) -> Result<(), Report>where I: Debug + Serialize,
Call a function on the plugin with the given input and ignore the output.
pub fn has_func(&self, func: &str) -> bool
pub fn has_func(&self, func: &str) -> bool
Return true if the plugin has a function with the given id.
pub fn from_virtual_path(&self, path: &Path) -> PathBuf
pub fn from_virtual_path(&self, path: &Path) -> PathBuf
Convert the provided virtual guest path to an absolute host path.
pub fn to_virtual_path(&self, path: &Path) -> PathBuf
pub fn to_virtual_path(&self, path: &Path) -> PathBuf
Convert the provided absolute host path to a virtual guest path suitable for WASI sandboxed runtimes.
Trait Implementations§
impl<'plugin> Send for PluginContainer<'plugin>
impl<'plugin> Sync for PluginContainer<'plugin>
Auto Trait Implementations§
impl<'plugin> !RefUnwindSafe for PluginContainer<'plugin>
impl<'plugin> Unpin for PluginContainer<'plugin>
impl<'plugin> !UnwindSafe for PluginContainer<'plugin>
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
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where T: AsFilelike,
self file descriptor.§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§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>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more