NAME

Wasm::Wasmtime::Extern - Wasmtime extern class

VERSION

version 0.23

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
      (func (export "foo") (param i32 i32) (result i32)
        local.get 0
        local.get 1
        i32.add)
      (memory (export "bar") 2 3)
    )
  }),
  $store,
);

my $foo = $instance->exports->foo;
print $foo->kind, "\n";  # func

my $bar = $instance->exports->bar;
print $bar->kind, "\n";  # memory

DESCRIPTION

This class represents an object exported from or imported into a Wasm::Wasmtime::Instance. This class cannot be created independently, but subclasses of this class can be retrieved from the Wasm::Wasmtime::Instance object. This is a base class and cannot be instantiated on its own.

It is a base class.

METHODS

kind

my $string = $extern->kind;

Returns the extern kind as a string. This will be one of:

func Wasm::Wasmtime::Func
global Wasm::Wasmtime::Global
table Wasm::Wasmtime::Table
memory Wasm::Wasmtime::Memory

is_func

my $bool = $extern->is_func;

Returns true if it is a function.

is_global

my $bool = $extern->is_global;

Returns true if it is a global.

is_table

my $bool = $extern->is_table;

Returns true if it is a table.

is_memory

my $bool = $extern->is_memory;

Returns true if it is a memory.

SEE ALSO

Wasm
Wasm::Wasmtime

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020-2022 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.