pub struct Table { /* private fields */ }
Expand description

A table instance.

Implementations

Create a new table instance with specified minimum and maximum number of elements.

Returns the type of the elements in this table.

Returns the number of allocated elements.

Fill table[dst..dst + len] with val.

Returns a trap error on out-of-bounds accesses.

Grow table by the specified amount of elements.

Returns the previous size of the table if growth is successful.

Returns None if table can’t be grown by the specified amount of elements, or if the init_value is the wrong kind of table element.

Unsafety

Resizing the table can reallocate its internal elements buffer. This table’s instance’s VMContext has raw pointers to the elements buffer that are used by Wasm, and they need to be fixed up before we call into Wasm again. Failure to do so will result in use-after-free inside Wasm.

Generally, prefer using InstanceHandle::table_grow, which encapsulates this unsafety.

Get reference to the specified element.

Returns None if the index is out of bounds.

Set reference to the specified element.

Errors

Returns an error if index is out of bounds or if this table type does not match the element type.

Copy len elements from src_table[src_index..] into dst_table[dst_index..].

Errors

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

Return a VMTableDefinition for exposing the table to compiled wasm code.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.