Struct tinywasm::Store

source ·
pub struct Store { /* private fields */ }
Expand description

Global state that can be manipulated by WebAssembly programs

Data should only be addressable by the module that owns it

Note that the state doesn’t do any garbage collection - so it will grow indefinitely if you keep adding modules to it. When calling temporary functions, you should create a new store and then drop it when you’re done (e.g. in a request handler)

See https://webassembly.github.io/spec/core/exec/runtime.html#store

Implementations§

source§

impl Store

source

pub fn new() -> Self

Create a new store

source

pub fn get_module_instance( &self, addr: ModuleInstanceAddr ) -> Option<&ModuleInstance>

Get a module instance by the internal id

source§

impl Store

source

pub fn id(&self) -> usize

Get the store’s ID (unique per process)

source

pub fn get_global_val(&self, addr: usize) -> Result<RawWasmValue>

Get the global at the actual index in the store

Trait Implementations§

source§

impl Debug for Store

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Store

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl PartialEq for Store

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Store

§

impl !Send for Store

§

impl !Sync for Store

§

impl Unpin for Store

§

impl !UnwindSafe for Store

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.