[][src]Struct wasmer::Table

pub struct Table { /* fields omitted */ }

A WebAssembly table instance.

The Table struct is an array-like structure representing a WebAssembly Table, which stores function references.

A table created by the host or in WebAssembly code will be accessible and mutable from both host and WebAssembly.

Spec: https://webassembly.github.io/spec/core/exec/runtime.html#table-instances

Implementations

impl Table[src]

pub fn new(
    store: &Store,
    ty: TableType,
    init: Val
) -> Result<Self, RuntimeError>
[src]

Creates a new Table with the provided TableType definition.

All the elements in the table will be set to the init value.

This function will construct the Table using the store BaseTunables.

pub fn ty(&self) -> &TableType[src]

Returns the TableType of the Table.

pub fn store(&self) -> &Store[src]

Returns the Store where the Table belongs.

pub fn get(&self, index: u32) -> Option<Val>[src]

Retrieves an element of the table at the provided index.

pub fn set(&self, index: u32, val: Val) -> Result<(), RuntimeError>[src]

Sets an element val in the Table at the provided index.

pub fn size(&self) -> u32[src]

Retrieves the size of the Table (in elements)

pub fn grow(&self, delta: u32, init: Val) -> Result<u32, RuntimeError>[src]

Grows the size of the Table by delta, initializating the elements with the provided init value.

It returns the previous size of the Table in case is able to grow the Table successfully.

Errors

Returns an error if the delta is out of bounds for the table.

pub fn copy(
    dst_table: &Self,
    dst_index: u32,
    src_table: &Self,
    src_index: u32,
    len: u32
) -> Result<(), RuntimeError>
[src]

Copies the len elements of src_table starting at src_index to the destination table dst_table at index dst_index.

Errors

Returns an error if the range is out of bounds of either the source or destination tables.

pub fn same(&self, other: &Self) -> bool[src]

Returns whether or not these two tables refer to the same data.

Trait Implementations

impl Clone for Table[src]

impl<'a> Exportable<'a> for Table[src]

impl From<Table> for Extern[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,