🌻 📖 Wasm::Wasmtime::ImportType

NAME

Wasm::Wasmtime::ImportType - Wasmtime import type class

VERSION

version 0.23

SYNOPSIS

 use Wasm::Wasmtime;
 
 my $module = Wasm::Wasmtime::Module->new( wat => q{
   (module
     (func $hello (import "xx" "hello"))
   )
 });
 
 my $hello = $module->imports->[0];
 
 print $hello->module, "\n";     # xx
 print $hello->name, "\n";       # hello
 print $hello->type->kind, "\n"; # functype

DESCRIPTION

This class represents an import from a module. It is essentially a name and an Wasm::Wasmtime::ExternType. The latter gives you the function signature and other configuration details for import objects.

CONSTRUCTOR

new

 my $importtype = Wasm::Wasmtime::ImportType->new(
   $module,       # Wasm::Wasmtime::Module
   $name,         # string
   $externtype,   # Wasm::Wasmtime::FuncType, ::MemoryType, ::GlobalType or ::TableType
 );

Creates a new import type object.

METHODS

name

 my $name = $importtype->name;

Returns the name of the import.

type

 my $externtype = $importtype->type;

Returns the Wasm::Wasmtime::ExternType for the import.

module

 my $name = $importtype->module;

Returns the name of the module for the import.

to_string

 my $string = $importtype->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-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.