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
Available on crate feature runtime only.
pub fn new(content: ValType, mutability: Mutability) -> GlobalType
runtime only.Creates a new global descriptor of the specified content type and
whether or not it’s mutable.
Sourcepub fn content(&self) -> &ValType
Available on crate feature runtime only.
pub fn content(&self) -> &ValType
runtime only.Returns the value type of this global descriptor.
Sourcepub fn mutability(&self) -> Mutability
Available on crate feature runtime only.
pub fn mutability(&self) -> Mutability
runtime only.Returns whether or not this global is mutable.
Sourcepub fn default_value(&self, store: impl AsContextMut) -> Result<RuntimeGlobal>
Available on crate feature runtime only.
pub fn default_value(&self, store: impl AsContextMut) -> Result<RuntimeGlobal>
runtime only.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
Available on crate feature runtime only.
impl Clone for GlobalType
Available on crate feature
runtime only.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
Available on crate feature runtime only.
impl Debug for GlobalType
Available on crate feature
runtime only.Source§impl From<GlobalType> for ExternType
Available on crate feature runtime only.
impl From<GlobalType> for ExternType
Available on crate feature
runtime only.Source§fn from(ty: GlobalType) -> ExternType
fn from(ty: GlobalType) -> ExternType
Converts to this type from the input type.
Source§impl Hash for GlobalType
Available on crate feature runtime only.
impl Hash for GlobalType
Available on crate feature
runtime only.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,
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