class Wasmer::Global

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.cr

Constructors

Instance Method Summary

Instance methods inherited from module Wasmer::WithExtern

to_extern : Extern to_extern

Constructor Detail

def self.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))

[View source]

Instance Method Detail

def get #

Returns the Global's value as native Crystal value


[View source]
def set(value) : Nil #

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


[View source]
def to_extern : Extern #

Converts the Global into an Extern


[View source]
def type : GlobalType #

Returns the Global's GlobalType


[View source]
def value #

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


[View source]
def value=(value) #

Sets the Global's value. it calls #set method


[View source]