Trait wasm_runtime_layer::backend::WasmTable

source ·
pub trait WasmTable<E: WasmEngine>: Clone + Sized + Send + Sync {
    // Required methods
    fn new(
        ctx: impl AsContextMut<E>,
        ty: TableType,
        init: Value<E>
    ) -> Result<Self>;
    fn ty(&self, ctx: impl AsContext<E>) -> TableType;
    fn size(&self, ctx: impl AsContext<E>) -> u32;
    fn grow(
        &self,
        ctx: impl AsContextMut<E>,
        delta: u32,
        init: Value<E>
    ) -> Result<u32>;
    fn get(&self, ctx: impl AsContextMut<E>, index: u32) -> Option<Value<E>>;
    fn set(
        &self,
        ctx: impl AsContextMut<E>,
        index: u32,
        value: Value<E>
    ) -> Result<()>;
}
Expand description

Provides a Wasm table reference.

Required Methods§

source

fn new(ctx: impl AsContextMut<E>, ty: TableType, init: Value<E>) -> Result<Self>

Creates a new table to the store.

source

fn ty(&self, ctx: impl AsContext<E>) -> TableType

Returns the type and limits of the table.

source

fn size(&self, ctx: impl AsContext<E>) -> u32

Returns the current size of the table.

source

fn grow( &self, ctx: impl AsContextMut<E>, delta: u32, init: Value<E> ) -> Result<u32>

Grows the table by the given amount of elements.

source

fn get(&self, ctx: impl AsContextMut<E>, index: u32) -> Option<Value<E>>

Returns the table element value at index.

source

fn set( &self, ctx: impl AsContextMut<E>, index: u32, value: Value<E> ) -> Result<()>

Sets the value of this table at index.

Object Safety§

This trait is not object safe.

Implementors§