NAME

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

VERSION

version 0.21

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 $foo = $module->exports->foo;
 print $foo->kind, "\n";  # functype
 
 my $bar = $module->exports->bar;
 print $bar->kind, "\n";  # memorytype

DESCRIPTION

This class represents an extern type. This class cannot be created independently, but subclasses of this class can be retrieved from the Wasm::Wasmtime::Module object. This is a base class and cannot be instantiated on its own.

METHODS

kind

 my $string = $externtype->kind;

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

functype Wasm::Wasmtime::FuncType
globaltype Wasm::Wasmtime::GlobalType
tabletype Wasm::Wasmtime::TableType
memorytype Wasm::Wasmtime::MemoryType

is_functype

 my $bool = $externtype->is_functype;

Returns true if it is a function type.

is_globaltype

 my $bool = $externtype->is_globaltype;

Returns true if it is a global type.

is_tabletype

 my $bool = $externtype->is_tabletype;

Returns true if it is a table type.

is_memorytype

 my $bool = $externtype->is_memorytype;

Returns true if it is a memory type.

to_string

 my $string = $externtype->to_string;

Converts the type into a string for diagnostics.

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.