using System;
using System.Diagnostics;
namespace Wasmtime.Imports
{
///
/// Represents a table imported to a WebAssembly module.
///
public class TableImport : Import
{
internal TableImport(IntPtr importType, IntPtr externType) : base(importType)
{
Debug.Assert(Interop.wasm_externtype_kind(externType) == Interop.wasm_externkind_t.WASM_EXTERN_TABLE);
var tableType = Interop.wasm_externtype_as_tabletype_const(externType);
Kind = Interop.wasm_valtype_kind(Interop.wasm_tabletype_element(tableType));
unsafe
{
var limits = Interop.wasm_tabletype_limits(tableType);
Minimum = limits->min;
Maximum = limits->max;
}
}
///
/// The value kind of the table.
///
public ValueKind Kind { get; private set; }
///
/// The minimum number of elements in the table.
///
public uint Minimum { get; private set; }
///
/// The maximum number of elements in the table.
///
public uint Maximum { get; private set; }
}
}