pub struct PluginInstance { /* private fields */ }Expand description
Implementations§
Source§impl PluginInstance
impl PluginInstance
Sourcepub fn invoke(&mut self, name: &str) -> Result<(), PluginError>
pub fn invoke(&mut self, name: &str) -> Result<(), PluginError>
Invokes an exported function that takes no parameters and returns nothing.
§Errors
Returns PluginError::MissingExport if the export does not exist or
has the wrong signature, or any other plugin error if execution fails.
§Examples
use martensite_plugin::{CapabilitySet, PluginRuntime};
let runtime = PluginRuntime::new().unwrap();
let mut plugin = runtime.load(wasm_bytes, CapabilitySet::empty()).unwrap();
plugin.invoke("run").unwrap();Sourcepub fn invoke_typed<Args, Rets>(
&mut self,
name: &str,
args: Args,
) -> Result<Rets, PluginError>where
Args: WasmParams,
Rets: WasmResults,
pub fn invoke_typed<Args, Rets>(
&mut self,
name: &str,
args: Args,
) -> Result<Rets, PluginError>where
Args: WasmParams,
Rets: WasmResults,
Invokes an exported function with a statically checked WebAssembly signature.
§Errors
Returns PluginError::MissingExport if the export does not exist or
has a signature different from Args -> Rets, or any execution error
produced by the plugin.
Sourcepub fn drain_paint_commands(&mut self, f: impl FnMut(&PluginPaintCmd, &[u8]))
pub fn drain_paint_commands(&mut self, f: impl FnMut(&PluginPaintCmd, &[u8]))
Drains paint commands from this instance’s host-side ring buffer.
The current ABI reports offset zero to the guest and keeps the backing allocation in host state. Mapping it directly into guest linear memory is reserved as a future shared-memory optimization.
Sourcepub fn capabilities(&self) -> &CapabilitySet
pub fn capabilities(&self) -> &CapabilitySet
Returns a reference to the capability set active for this instance.
Auto Trait Implementations§
impl !RefUnwindSafe for PluginInstance
impl !Sync for PluginInstance
impl !UnwindSafe for PluginInstance
impl Freeze for PluginInstance
impl Send for PluginInstance
impl Unpin for PluginInstance
impl UnsafeUnpin for PluginInstance
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<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,
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,
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> ⓘ
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> ⓘ
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