InstanceState

Trait InstanceState 

Source
pub trait InstanceState {
    // Required methods
    fn global_get(
        &mut self,
        name: &str,
    ) -> impl Future<Output = SnapshotVal> + Send;
    fn memory_contents(
        &mut self,
        name: &str,
        contents: impl FnOnce(&[u8]) + Send,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

Abstract ability to load state from a WebAssembly instance after it’s been instantiated and some exports have run.

Required Methods§

Source

fn global_get(&mut self, name: &str) -> impl Future<Output = SnapshotVal> + Send

Loads the global specified by name, returning a SnapshotVal.

§Panics

This function panics if name isn’t an exported global or if the type of the global doesn’t fit in SnapshotVal.

Source

fn memory_contents( &mut self, name: &str, contents: impl FnOnce(&[u8]) + Send, ) -> impl Future<Output = ()> + Send

Loads the contents of the memory specified by name, returning the entier contents as a Vec<u8>.

§Panics

This function panics if name isn’t an exported memory.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Send> InstanceState for WasmtimeWizer<'_, T>

Available on crate feature wasmtime only.