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§

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.

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.

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.

Returns a reference to the type of this Global instance.

Returns the current value of this Global instance.

Sets a new value of this Global instance.

Notice that only global variables of Var type are allowed to perform this function.

Argument
  • value - The new value of the Global instance.
Error

If fail to update the value of the global variable, then an error is returned.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.