tinywasm 0.9.0-alpha.1

A tiny WebAssembly interpreter
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::interpreter::TinyWasmValue;
use core::cell::Cell;
use tinywasm_types::*;

/// A WebAssembly Global Instance
///
/// See <https://webassembly.github.io/spec/core/exec/runtime.html#global-instances>
#[cfg_attr(feature = "debug", derive(Debug))]
pub(crate) struct GlobalInstance {
    pub(crate) value: Cell<TinyWasmValue>,
    pub(crate) ty: GlobalType,
}

impl GlobalInstance {
    pub(crate) fn new(ty: GlobalType, value: TinyWasmValue) -> Self {
        Self { ty, value: value.into() }
    }
}