Wasm::Wasmtime::ExternType - Wasmtime extern type class
version 0.23
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
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.
my $string = $externtype->kind;
Returns the extern type kind as a string. This will be one of:
functype
Wasm::Wasmtime::FuncTypeglobaltype
Wasm::Wasmtime::GlobalTypetabletype
Wasm::Wasmtime::TableTypememorytype
Wasm::Wasmtime::MemoryTypemy $bool = $externtype->is_functype;
Returns true if it is a function type.
my $bool = $externtype->is_globaltype;
Returns true if it is a global type.
my $bool = $externtype->is_tabletype;
Returns true if it is a table type.
my $bool = $externtype->is_memorytype;
Returns true if it is a memory type.
my $string = $externtype->to_string;
Converts the type into a string for diagnostics.
Graham Ollis <plicease@cpan.org>
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.