NAME
Wasm::Wasmtime::Extern - Wasmtime extern class
VERSION
version 0.03
SYNOPSIS
use Wasm::Wasmtime;
my $instance = Wasm::Wasmtime::Instance->new(
Wasm::Wasmtime::Module->new(wat => q{
(module
(func (export "foo") (param i32 i32) (result i32)
local.get 0
local.get 1
i32.add)
(memory (export "bar") 2 3)
)
}),
);
my $externtype_foo = $instance->get_export('foo');
print $externtype_foo->kind, "\n"; # func
my $externtype_bar = $instance->get_export('bar');
print $externtype_bar->kind, "\n"; # memory
DESCRIPTION
This class represents an object exported from Wasm::Wasmtime::Instance.
METHODS
type
my $externtype = $extern->type;
Returns the Wasm::Wasmtime::ExternType for this extern.
kind
my $kind = $extern->kind;
Returns the kind of extern. Should be one of:
func
global
table
memory
kind_num
my $kind = $extern->kind_num;
Returns the kind of extern as the internal integer used by Wasmtime.
as_func
my $func = $extern->as_func;
If the extern is a func
, returns its Wasm::Wasmtime::Func. Otherwise returns undef
.
as_memory
my $memory = $extern->as_memory;
If the extern is a memory
, returns its Wasm::Wasmtime::Memory. Otherwise returns undef
.
AUTHOR
Graham Ollis <plicease@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 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.