Struct extism_runtime::Plugin
source · pub struct Plugin {
pub modules: BTreeMap<String, Module>,
pub linker: Linker<Internal>,
pub instance: Instance,
pub instantiations: usize,
pub memory: UnsafeCell<PluginMemory>,
pub timer_id: Uuid,
/* private fields */
}Expand description
Plugin contains everything needed to execute a WASM function
Fields§
§modules: BTreeMap<String, Module>All modules that were provided to the linker
linker: Linker<Internal>Used to define functions and create new instances
instance: InstanceInstance provides the ability to call functions in a module
instantiations: usizeKeep track of the number of times we’re instantiated, this exists
to avoid issues with memory piling up since Instances are only
actually cleaned up along with a Store
memory: UnsafeCell<PluginMemory>Handles interactions with WASM memory
timer_id: UuidThe ID used to identify this plugin with the Timer
Implementations§
source§impl Plugin
impl Plugin
sourcepub fn new<'a>(
wasm: impl AsRef<[u8]>,
imports: impl IntoIterator<Item = &'a Function>,
with_wasi: bool
) -> Result<Plugin, Error>
pub fn new<'a>( wasm: impl AsRef<[u8]>, imports: impl IntoIterator<Item = &'a Function>, with_wasi: bool ) -> Result<Plugin, Error>
Create a new plugin from the given WASM code
pub fn error<E>(&self, e: impl Debug, x: E) -> E
sourcepub fn set_input(&mut self, input: *const u8, len: usize)
pub fn set_input(&mut self, input: *const u8, len: usize)
Store input in memory and initialize Internal pointer
sourcepub fn dump_memory(&self)
pub fn dump_memory(&self)
Dump memory using trace! logging
sourcepub fn reinstantiate(&mut self) -> Result<(), Error>
pub fn reinstantiate(&mut self) -> Result<(), Error>
Create a new instance from the same modules
Trait Implementations§
source§impl InternalExt for Plugin
impl InternalExt for Plugin
Auto Trait Implementations§
impl !RefUnwindSafe for Plugin
impl !Send for Plugin
impl !Sync for Plugin
impl Unpin for Plugin
impl !UnwindSafe for 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
Mutably borrows from an owned value. Read more
§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,
Query the “status” flags for the
self file descriptor.