[−][src]Struct wasmer::Table
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<Table, RuntimeError>
[src]
store: &Store,
ty: TableType,
init: Val
) -> Result<Table, RuntimeError>
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 Tunables
.
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: &Table,
dst_index: u32,
src_table: &Table,
src_index: u32,
len: u32
) -> Result<(), RuntimeError>
[src]
dst_table: &Table,
dst_index: u32,
src_table: &Table,
src_index: u32,
len: u32
) -> Result<(), RuntimeError>
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]
fn to_export(&self) -> Export
[src]
fn get_self_from_extern(_extern: &'a Extern) -> Result<&'a Self, ExportError>
[src]
impl From<Table> for Extern
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl !UnwindSafe for Table
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,