Struct wasmtime_runtime::Table[][src]

pub struct Table(_);
Expand description

Represents an instance’s table.

Implementations

impl Table[src]

pub fn new_dynamic(plan: &TablePlan) -> Self[src]

Create a new dynamic (movable) table instance for the specified table plan.

pub fn new_static(plan: &TablePlan, data: *mut *mut u8, maximum: u32) -> Self[src]

Create a new static (immovable) table instance for the specified table plan.

pub fn element_type(&self) -> TableElementType[src]

Returns the type of the elements in this table.

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

Returns the number of allocated elements.

pub fn maximum(&self) -> Option<u32>[src]

Returns the maximum number of elements.

pub fn fill(&self, dst: u32, val: TableElement, len: u32) -> Result<(), Trap>[src]

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

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

pub unsafe fn grow(&self, delta: u32, init_value: TableElement) -> Option<u32>[src]

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.

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

Get reference to the specified element.

Returns None if the index is out of bounds.

pub fn set(&self, index: u32, elem: TableElement) -> Result<(), ()>[src]

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.

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

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.

pub fn vmtable(&self) -> VMTableDefinition[src]

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

Trait Implementations

impl Debug for Table[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Table[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl Drop for Table[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V