pub struct Store<'inst, T: ?Sized> { /* private fields */ }
Expand description
The Store is a collection of registered modules and assists wasm modules in finding the import modules they need.
Implementations§
Source§impl<'inst, T: AsInstance + ?Sized> Store<'inst, T>
impl<'inst, T: AsInstance + ?Sized> Store<'inst, T>
Sourcepub fn new(
config: Option<&Config>,
instances: HashMap<String, &'inst mut T>,
) -> WasmEdgeResult<Self>
pub fn new( config: Option<&Config>, instances: HashMap<String, &'inst mut T>, ) -> WasmEdgeResult<Self>
Sourcepub fn register_active_module(
&mut self,
module: &Module,
) -> WasmEdgeResult<Instance>
pub fn register_active_module( &mut self, module: &Module, ) -> WasmEdgeResult<Instance>
Registers and instantiates a WasmEdge compiled module into this store as an anonymous active module instance, and returns the module instance.
§Arguments
-
executor
- The executor that runs the host functions in this store. -
module
- The validated module to be registered.
§Error
If fail to register the given module, then an error is returned.
pub fn register_named_module( &mut self, name: impl AsRef<str>, module: &Module, ) -> WasmEdgeResult<()>
Sourcepub fn named_instance_count(&self) -> usize
pub fn named_instance_count(&self) -> usize
Returns the number of the named module instances in this store.
Sourcepub fn instance_names(&self) -> Vec<String>
pub fn instance_names(&self) -> Vec<String>
Returns the names of all registered named module instances.
pub fn get_instance_and_executor( &mut self, mod_name: impl AsRef<str>, ) -> Option<(&mut T, &mut Executor)>
pub fn get_named_wasm_and_executor( &mut self, mod_name: impl AsRef<str>, ) -> Option<(&mut Instance, &mut Executor)>
pub fn executor(&mut self) -> &mut Executor
Trait Implementations§
Auto Trait Implementations§
impl<'inst, T> Freeze for Store<'inst, T>where
T: ?Sized,
impl<'inst, T> RefUnwindSafe for Store<'inst, T>where
T: RefUnwindSafe + ?Sized,
impl<'inst, T> Send for Store<'inst, T>
impl<'inst, T> Sync for Store<'inst, T>
impl<'inst, T> Unpin for Store<'inst, T>where
T: ?Sized,
impl<'inst, T> !UnwindSafe for Store<'inst, T>
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