Wasmer PHP

ValType

Value types classify the individual values that WebAssembly code can compute with and the values that a variable accepts.

<?php declare(strict_types=1);

use Wasm\Type\ValType;

$valtype = Type\ValType::new(Type\ValType::KIND_I32);
Tags
see
https://webassembly.github.io/spec/core/syntax/types.html#value-types

WebAssembly Specification - Value Types

Table of Contents

KIND_ANYREF  = WASM_ANYREF
KIND_F32  = WASM_F32
KIND_F64  = WASM_F64
KIND_FUNCREF  = WASM_FUNCREF
KIND_I32  = WASM_I32
KIND_I64  = WASM_I64
__construct()  : mixed
Create a Wasm\Type\ValType from a `wasm_valtype_t` resource.
inner()  : resource
Return the inner value type resource.
isNum()  : bool
Check if the value type is a numeric type.
isRef()  : bool
Check if the value type is a reference type.
kind()  : int
Check the value type's type.
new()  : self

Constants

KIND_ANYREF

public mixed KIND_ANYREF = WASM_ANYREF

KIND_F32

public mixed KIND_F32 = WASM_F32

KIND_F64

public mixed KIND_F64 = WASM_F64

KIND_FUNCREF

public mixed KIND_FUNCREF = WASM_FUNCREF

KIND_I32

public mixed KIND_I32 = WASM_I32

KIND_I64

public mixed KIND_I64 = WASM_I64

Methods

__construct()

Create a Wasm\Type\ValType from a `wasm_valtype_t` resource.

public __construct( $valtype) : mixed
Parameters
$valtype :

resource a wasm_valtype_t resource

Tags
throws
InvalidArgumentException

If the $valtype argument is not a valid wasm_valtype_t resource

Return values
mixed

inner()

Return the inner value type resource.

public inner() : resource
Return values
resource

A wasm_valtype_t resource

isNum()

Check if the value type is a numeric type.

public isNum() : bool
Return values
bool

isRef()

Check if the value type is a reference type.

public isRef() : bool
Return values
bool

kind()

Check the value type's type.

public kind() : int
Return values
int

new()

public static new(int $kind) : self
Parameters
$kind : int
Tags
throws
InvalidArgumentException

If the $kind is not a valid value kind

Return values
self

Search results