Trait WasmStore

Source
pub trait WasmStore<T, E: WasmEngine>: AsContext<E, UserState = T> + AsContextMut<E, UserState = T> {
    // Required methods
    fn new(engine: &E, data: T) -> Self;
    fn engine(&self) -> &E;
    fn data(&self) -> &T;
    fn data_mut(&mut self) -> &mut T;
    fn into_data(self) -> T;
}
Expand description

Provides all of the global state that can be manipulated by WASM programs.

Required Methods§

Source

fn new(engine: &E, data: T) -> Self

Creates a new store atop the given engine.

Source

fn engine(&self) -> &E

Gets the engine associated with this store.

Source

fn data(&self) -> &T

Gets an immutable reference to the underlying stored data.

Source

fn data_mut(&mut self) -> &mut T

Gets a mutable reference to the underlying stored data.

Source

fn into_data(self) -> T

Consumes self and returns its user provided data.

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§