[−][src]Struct wasmer::Global
A WebAssembly global
instance.
A global instance is the runtime representation of a global variable. It consists of an individual value and a flag indicating whether it is mutable.
Spec: https://webassembly.github.io/spec/core/exec/runtime.html#global-instances
Implementations
impl Global
[src]
pub fn new(store: &Store, val: Val) -> Global
[src]
Create a new Global
with the initial value Val
.
pub fn new_mut(store: &Store, val: Val) -> Global
[src]
Create a mutable Global
with the initial value Val
.
pub fn ty(&self) -> &GlobalType
[src]
Returns the GlobalType
of the Global
.
pub fn store(&self) -> &Store
[src]
Returns the Store
where the Global
belongs.
pub fn get(&self) -> Val
[src]
Retrieves the current value Val
that the Global has.
pub fn set(&self, val: Val) -> Result<(), RuntimeError>
[src]
Sets a custom value Val
to the runtime Global.
Errors
This function will error if:
- The global is not mutable
- The type of the
Val
doesn't matches the Global type.
pub fn same(&self, other: &Global) -> bool
[src]
Returns whether or not these two globals refer to the same data.
Trait Implementations
impl Clone for Global
[src]
impl Debug for Global
[src]
impl<'a> Exportable<'a> for Global
[src]
fn to_export(&self) -> Export
[src]
fn get_self_from_extern(_extern: &'a Extern) -> Result<&'a Self, ExportError>
[src]
impl From<Global> for Extern
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Global
impl Send for Global
impl Sync for Global
impl Unpin for Global
impl !UnwindSafe for Global
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,