NAME
Wasm::Wasmtime::Table - Wasmtime table class
VERSION
version 0.24
SYNOPSIS
use Wasm::Wasmtime;
my $store = Wasm::Wasmtime::Store->new;
my $instance = Wasm::Wasmtime::Instance->new(
Wasm::Wasmtime::Module->new($store->engine, wat => q{
(module
(table (export "table") 1 funcref)
)
}),
$store,
);
my $table = $instance->exports->table;
print $table->type->element->kind, "\n"; # funcref
print $table->size, "\n"; # 1
DESCRIPTION
WARNING: WebAssembly and Wasmtime are a moving target and the interface for these modules is under active development. Use with caution.
This class represents a WebAssembly table object.
Note that Perl-space marshalling of funcref / externref table elements is limited; "get" currently returns undef for reference values.
CONSTRUCTOR
new
my $table = Wasm::Wasmtime::Table->new(
$store, # Wasm::Wasmtime::Store
$tabletype, # Wasm::Wasmtime::TableType
);
Creates a new table whose elements are initialized to null.
METHODS
type
my $tabletype = $table->type;
Returns the Wasm::Wasmtime::TableType object for this table object.
size
my $size = $table->size;
Returns the size of the table in elements.
get
my $value = $table->get($index);
Returns the value at $index, or undef if the index is out of bounds (or the element is a reference value that cannot be represented in Perl).
grow
my $bool = $table->grow($delta);
Grows the table by $delta null elements. Returns true on success.
SEE ALSO
AUTHOR
Graham Ollis <plicease@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020-2026 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.