🌻 📖 Wasm::Wasmtime::FuncType

NAME

Wasm::Wasmtime::FuncType - Wasmtime function type class

VERSION

version 0.23

SYNOPSIS

 use Wasm::Wasmtime;
 
 my $functype = Wasm::Wasmtime::FuncType->new(
   # This function type takes a 32 bit and 64 bit
   # integer and returns a double floating point
   [ 'i32', 'i64' ] => [ 'f64' ],
 );

DESCRIPTION

WARNING: WebAssembly and Wasmtime are a moving target and the interface for these modules is under active development. Use with caution.

The function type class represents a function signature, that is the parameter and return types that a function will take.

CONSTRUCTOR

new

 my $functype = Wasm::Wasmtime::FuncType->new(\@params, \@results);

Creates a new function type instance. @params and @results should be a list of either Wasm::Wasmtime::ValType objects, or the string representation of those types (i32, f64, etc).

METHODS

params

 my @params = $functype->params;

Returns a list of the parameter types for the function type, as Wasm::Wasmtime::ValType objects.

results

 my @params = $functype->results;

Returns a list of the result types for the function type, as Wasm::Wasmtime::ValType objects.

to_string

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