pub struct WasmtimeInstance { /* private fields */ }
Expand description
A wrapper around a Wasmtime instance.
The Wasmtime engine constructs a new store and compiles an instance of a Wasm module.
Implementations§
Source§impl WasmtimeInstance
impl WasmtimeInstance
Sourcepub fn new(store: Store<StoreLimits>, module: Module) -> Result<Self>
pub fn new(store: Store<StoreLimits>, module: Module) -> Result<Self>
Instantiate a new Wasmtime instance.
Sourcepub fn exported_functions(&mut self) -> Vec<(String, FuncType)>
pub fn exported_functions(&mut self) -> Vec<(String, FuncType)>
Retrieve the names and types of all exported functions in the instance.
This is useful for evaluating each exported function with different
values. The DiffInstance
trait asks for the function name and we
need to know the function signature in order to pass in the right
arguments.
Sourcepub fn exported_globals(&mut self) -> Vec<(String, DiffValueType)>
pub fn exported_globals(&mut self) -> Vec<(String, DiffValueType)>
Returns the list of globals and their types exported from this instance.
Sourcepub fn exported_memories(&mut self) -> Vec<(String, bool)>
pub fn exported_memories(&mut self) -> Vec<(String, bool)>
Returns the list of exported memories and whether or not it’s a shared memory.
Trait Implementations§
Source§impl DiffInstance for WasmtimeInstance
impl DiffInstance for WasmtimeInstance
Source§fn evaluate(
&mut self,
function_name: &str,
arguments: &[DiffValue],
_results: &[DiffValueType],
) -> Result<Option<Vec<DiffValue>>>
fn evaluate( &mut self, function_name: &str, arguments: &[DiffValue], _results: &[DiffValueType], ) -> Result<Option<Vec<DiffValue>>>
Evaluate an exported function with the given values. Read more
Source§fn get_global(&mut self, name: &str, _ty: DiffValueType) -> Option<DiffValue>
fn get_global(&mut self, name: &str, _ty: DiffValueType) -> Option<DiffValue>
Attempts to return the value of the specified global, returning
None
if this engine doesn’t support retrieving globals at this time.Auto Trait Implementations§
impl Freeze for WasmtimeInstance
impl !RefUnwindSafe for WasmtimeInstance
impl Send for WasmtimeInstance
impl Sync for WasmtimeInstance
impl Unpin for WasmtimeInstance
impl !UnwindSafe for WasmtimeInstance
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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