Struct wasmtime::Global [−][src]
A WebAssembly global value which can be read and written to.
A global in WebAssembly is sort of like a global variable within an
Instance. The global.get and global.set
instructions will modify and read global values in a wasm module. Globals
can either be imported or exported from wasm modules.
If you’re familiar with Rust already you can think of a Global as a sort
of Rc<Cell<Val>>, more or less.
Global and Clone
Globals are internally reference counted so you can clone a Global. The
cloning process only performs a shallow clone, so two cloned Global
instances are equivalent in their functionality.
Implementations
impl Global[src]
pub fn new(store: &Store, ty: GlobalType, val: Val) -> Result<Global>[src]
Creates a new WebAssembly global value with the provide type ty and
initial value val.
The store argument provided is used as a general global cache for
information, and otherwise the ty and val arguments are used to
initialize the global.
Errors
Returns an error if the ty provided does not match the type of the
value val.
pub fn ty(&self) -> GlobalType[src]
Returns the underlying type of this global.
pub fn val_type(&self) -> ValType[src]
Returns the value type of this global.
pub fn mutability(&self) -> Mutability[src]
Returns the underlying mutability of this global.
pub fn get(&self) -> Val[src]
Returns the current Val of this global.
pub fn set(&self, val: Val) -> Result<()>[src]
Trait Implementations
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,
pub 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> Pointable for T[src]
pub const ALIGN: usize[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T[src]
pub unsafe fn drop(ptr: usize)[src]
impl<T> Same<T> for T[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
    T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub 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.
pub 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>,