class Wasmer::Global
- Wasmer::Global
- Reference
- Object
Overview
Global
stores a single value of the given GlobalType
See Also
https://webassembly.github.io/spec/core/syntax/modules.html#globals
Included Modules
Defined in:
wasmer/global.crConstructors
-
.new(store : Store, type : GlobalType, value : Value)
Instantiates a new
Global
in the givenStore
It takes three arguments, theStore
, theGlobalType
and theValue
Instance Method Summary
-
#get
Returns the
Global
's value as native Crystal value -
#set(value) : Nil
Sets the
Global
's value It takes two arguments, value as a native Crystal value - #to_extern : Extern
-
#type : GlobalType
Returns the
Global
'sGlobalType
-
#value
Returns the
Global
's value as native Crystal value. -
#value=(value)
Sets the
Global
's value.
Instance methods inherited from module Wasmer::WithExtern
to_extern : Extern
to_extern
Constructor Detail
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))