class

Wasmer::Global

Inherits Wasmer::WithExtern / Reference / Object

Global stores a single value of the given GlobalType See Also https://webassembly.github.io/spec/core/syntax/modules.html#globals

Constructors

new(store : Store, type : GlobalType, value : Value)

Instantiates a new Global in the given Store It takes three arguments, the Store, the GlobalType and the Value

val_type = ValueType.new(Wasmer::I32)
global_type = GlobalType.new(val_type, Wasmer::Immutable)
global = Global.new(store, global_type, Value.new(42))
Source

Instance methods

get

Returns the Global's value as native Crystal value

Source
set(value) : Nil

Sets the Global's value It takes two arguments, value as a native Crystal value

Source
to_extern

Converts the Global into an Extern

Source
type

Returns the Global's GlobalType

Source
value

Returns the Global's value as native Crystal value. it just calls get

Source
value=(value)

Sets the Global's value. it calls set method

Source