NAME

Wasm::Wasmtime::ExternType - Wasmtime extern type class

VERSION

version 0.06

SYNOPSIS

use Wasm::Wasmtime;

my $module = 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 = $module->get_export('foo');
print $externtype_foo->kind, "\n";  # func

my $externtype_bar = $module->get_export('bar');
print $externtype_bar->kind, "\n";  # memory

DESCRIPTION

This class represents an extern type. This class cannot be created independently, but can be retrieved from the Wasm::Wasmtime::Module class.

METHODS

kind

my $kind = $externtype->kind;

Returns the kind of extern type. Should be one of:

func
global
table
memory

kind_num

my $kind = $externtype->kind_num;

Returns the kind of extern type as the internal integer code.

as_functype

my $functype = $externtype->as_functype;

If the extern type is a function, returns the Wasm::Wasmtime::FuncType for it. Otherwise returns undef.

as_globaltype

my $globaltype = $externtype->as_globaltype;

If the extern type is a global object, returns the Wasm::Wasmtime::GlobalType for it. Otherwise returns undef.

as_tabletype

my $tabletype = $externtype->as_tabletype;

If the extern type is a table object, returns the Wasm::Wasmtime::TableType for it. Otherwise returns undef.

as_memorytype

my $memorytype = $externtype->as_memorytype;

If the extern type is a memory object, returns the Wasm::Wasmtime::MemoryType for it. Otherwise returns undef.

SEE ALSO

Wasm
Wasm::Wasmtime

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.