Skip to main content

WasmTable

Trait WasmTable 

Source
pub trait WasmTable<E: WasmEngine>:
    Clone
    + Sized
    + Send
    + Sync {
    // Required methods
    fn new(
        ctx: impl AsContextMut<E>,
        ty: TableType,
        init: Ref<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: Ref<E>,
    ) -> Result<u32>;
    fn get(&self, ctx: impl AsContextMut<E>, index: u32) -> Option<Ref<E>>;
    fn set(
        &self,
        ctx: impl AsContextMut<E>,
        index: u32,
        elem: Ref<E>,
    ) -> Result<()>;
}
Expand description

Provides a Wasm table reference.

Required Methods§

Source

fn new(ctx: impl AsContextMut<E>, ty: TableType, init: Ref<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: Ref<E>, ) -> Result<u32>

Grows the table by the given amount of elements.

Source

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

Returns the table element at index.

Source

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

Sets the element of this table at index.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§