pub struct Global(/* private fields */);Expand description
A Wasm global variable reference.
Implementations§
Source§impl Global
impl Global
Sourcepub fn new(
ctx: impl AsContextMut,
initial_value: Val,
mutability: Mutability,
) -> Self
pub fn new( ctx: impl AsContextMut, initial_value: Val, mutability: Mutability, ) -> Self
Creates a new global variable to the store.
Sourcepub fn ty(&self, ctx: impl AsContext) -> GlobalType
pub fn ty(&self, ctx: impl AsContext) -> GlobalType
Returns the GlobalType of the global variable.
Sourcepub fn set(
&self,
ctx: impl AsContextMut,
new_value: Val,
) -> Result<(), GlobalError>
pub fn set( &self, ctx: impl AsContextMut, new_value: Val, ) -> Result<(), GlobalError>
Trait Implementations§
impl Copy for Global
Auto Trait Implementations§
impl Freeze for Global
impl RefUnwindSafe for Global
impl Send for Global
impl Sync for Global
impl Unpin for Global
impl UnwindSafe for Global
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more