Class Table
Represents a Wasmer Table. Use the Create static method to create new instances of the table.
Namespace: WasmerSharp
Assembly: WasmerSharp.dll
Syntax
public class Table : WasmerSharp.WasmerNativeHandle
Remarks
A table is similar to a linear memory whose elements, instead of being bytes, are opaque values of a particular table element type. This allows the table to contain values—like GC references, raw OS handles, or native pointers—that are accessed by WebAssembly code indirectly through an integer index. This feature bridges the gap between low-level, untrusted linear memory and high-level opaque handles/references at the cost of a bounds-checked table indirection.
The table’s element type constrains the type of elements stored in the table and allows engines to avoid some type checks on table use. When a WebAssembly value is stored in a table, the value’s type must precisely match the element type. Depending on the operator/API used to store the value, this check may be static or dynamic. Just like linear memory, updates to a table are observed immediately by all instances that reference the table. Host environments may also allow storing non-WebAssembly values in tables in which case, as with imports, the meaning of using the value is defined by the host environment.
Properties
Length
Returns the current length of the given Table
Declaration
public uint Length { get; }
Property Value
Type | Description |
---|---|
System.UInt32 | To be added. |
Methods
Create(UInt32, Nullable<UInt32>)
Creates a new Table for the given descriptor
Declaration
public static WasmerSharp.Table Create (uint min, Nullable<uint> max = null);
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | min | Minimum number of elements to store on the table. |
System.Nullable<System.UInt32> | max | Optional, maximum number of elements to store on the table. |
Returns
Type | Description |
---|---|
Table | An instance of Table on success, or null on error. You can use the LastError error property to get details on the error. |
Grow(UInt32)
Attemps to grow the table by the specified number of elements.
Declaration
public bool Grow (uint delta);
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | delta | Number of elements to add to the table. |
Returns
Type | Description |
---|---|
System.Boolean | true on success, false on failure. You can use the LastError error property to get details on the error. |