pub struct GlobalType { /* private fields */ }Expand description
A WebAssembly global descriptor.
This type describes an instance of a global in a WebAssembly module. Globals
are local to an Instance and are either immutable or
mutable.
Implementations§
Source§impl GlobalType
 
impl GlobalType
Sourcepub fn new(content: ValType, mutability: Mutability) -> GlobalType
 
pub fn new(content: ValType, mutability: Mutability) -> GlobalType
Creates a new global descriptor of the specified content type and
whether or not it’s mutable.
Sourcepub fn mutability(&self) -> Mutability
 
pub fn mutability(&self) -> Mutability
Returns whether or not this global is mutable.
Sourcepub fn default_value(&self, store: impl AsContextMut) -> Result<Global, Error>
 
pub fn default_value(&self, store: impl AsContextMut) -> Result<Global, Error>
Construct a new global import with this type’s default value.
This creates a host Global in the given store initialized to the
type’s zero/null default (e.g. 0 for numeric globals, null_ref for refs).
Trait Implementations§
Source§impl Clone for GlobalType
 
impl Clone for GlobalType
Source§fn clone(&self) -> GlobalType
 
fn clone(&self) -> GlobalType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl Debug for GlobalType
 
impl Debug for GlobalType
Source§impl From<GlobalType> for ExternType
 
impl From<GlobalType> for ExternType
Source§fn from(ty: GlobalType) -> ExternType
 
fn from(ty: GlobalType) -> ExternType
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for GlobalType
impl !RefUnwindSafe for GlobalType
impl Send for GlobalType
impl Sync for GlobalType
impl Unpin for GlobalType
impl !UnwindSafe for GlobalType
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
 
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
 
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more