Struct wasmedge_sdk::Global
source · pub struct Global { /* private fields */ }
Expand description
Defines a WebAssembly global variable, which stores a single value of the given GlobalType and a flag indicating whether it is mutable or not.
Implementations§
source§impl Global
impl Global
sourcepub fn new(ty: GlobalType, init: Val) -> WasmEdgeResult<Self>
pub fn new(ty: GlobalType, init: Val) -> WasmEdgeResult<Self>
Creates a new wasm Global instance with the given type and initial value.
Arguments
-
ty
- The type of the Global instance to be created. -
init
- The initial value of the Global instance.
Error
- If fail to create the Global instance, then WasmEdgeError::Global(GlobalError::Create)(crate::error::GlobalError) is returned.
sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
Returns the exported name of this Global instance.
Notice that this field is meaningful only if this Global instance is used as an exported instance.
sourcepub fn mod_name(&self) -> Option<&str>
pub fn mod_name(&self) -> Option<&str>
Returns the name of the module instance from which this Global instance exports.
Notice that this field is meaningful only if this Global instance is used as an exported instance.
sourcepub fn ty(&self) -> &GlobalType
pub fn ty(&self) -> &GlobalType
Returns a reference to the type of this Global instance.