pub trait Table: Debug + Send + Sync + MemoryUsage {
fn style(&self) -> &TableStyle;
fn ty(&self) -> &TableType;
fn size(&self) -> u32;
fn grow(&self, delta: u32, init_value: TableElement) -> Option<u32>;
fn get(&self, index: u32) -> Option<TableElement>;
fn set(&self, index: u32, reference: TableElement) -> Result<(), Trap>;
fn vmtable(&self) -> NonNull<VMTableDefinition>;
fn copy(
&self,
src_table: &dyn Table,
dst_index: u32,
src_index: u32,
len: u32
) -> Result<(), Trap> { ... }
}
Expand description
Trait for implementing the interface of a Wasm table.
Required methods
fn style(&self) -> &TableStyle
fn style(&self) -> &TableStyle
Returns the style for this Table.
Grow table by the specified amount of elements.
Returns None
if table can’t be grown by the specified amount
of elements, otherwise returns the previous size of the table.
fn get(&self, index: u32) -> Option<TableElement>
fn get(&self, index: u32) -> Option<TableElement>
Get reference to the specified element.
Returns None
if the index is out of bounds.
fn vmtable(&self) -> NonNull<VMTableDefinition>
fn vmtable(&self) -> NonNull<VMTableDefinition>
Return a VMTableDefinition
for exposing the table to compiled wasm code.
Provided methods
Implementations on Foreign Types
sourceimpl Table for LinearTable
impl Table for LinearTable
sourcepub fn style(&self) -> &TableStyle
pub fn style(&self) -> &TableStyle
Returns the style for this Table.
sourcepub fn grow(&self, delta: u32, init_value: TableElement) -> Option<u32>
pub fn grow(&self, delta: u32, init_value: TableElement) -> Option<u32>
Grow table by the specified amount of elements.
Returns None
if table can’t be grown by the specified amount
of elements, otherwise returns the previous size of the table.
sourcepub fn get(&self, index: u32) -> Option<TableElement>
pub fn get(&self, index: u32) -> Option<TableElement>
Get reference to the specified element.
Returns None
if the index is out of bounds.
sourcepub fn vmtable(&self) -> NonNull<VMTableDefinition>
pub fn vmtable(&self) -> NonNull<VMTableDefinition>
Return a VMTableDefinition
for exposing the table to compiled wasm code.