pub struct GlobalRef(_);
Expand description
Reference to a global variable (See GlobalInstance
for details).
This reference has a reference-counting semantics.
Methods from Deref<Target = GlobalInstance>
sourcepub fn set(&self, val: RuntimeValue) -> Result<(), Error>
pub fn set(&self, val: RuntimeValue) -> Result<(), Error>
Change the value of this global variable.
Errors
Returns Err
if this global isn’t mutable or if
type of val
doesn’t match global’s type.
sourcepub fn get(&self) -> RuntimeValue
pub fn get(&self) -> RuntimeValue
Get the value of this global variable.
sourcepub fn is_mutable(&self) -> bool
pub fn is_mutable(&self) -> bool
Returns if this global variable is mutable.
Note: Imported and/or exported globals are always immutable.
sourcepub fn value_type(&self) -> ValueType
pub fn value_type(&self) -> ValueType
Returns value type of this global variable.
Trait Implementations
sourceimpl Deref for GlobalRef
impl Deref for GlobalRef
type Target = GlobalInstance
type Target = GlobalInstance
The resulting type after dereferencing.
sourcefn deref(&self) -> &GlobalInstance
fn deref(&self) -> &GlobalInstance
Dereferences the value.
Auto Trait Implementations
impl !RefUnwindSafe for GlobalRef
impl !Send for GlobalRef
impl !Sync for GlobalRef
impl Unpin for GlobalRef
impl !UnwindSafe for GlobalRef
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more