#[repr(C, align(16))]
pub struct VMGlobalDefinition { /* private fields */ }
Expand description

The storage for a WebAssembly global defined within the instance.

TODO: Pack the globals more densely, rather than using the same size for every type.

Implementations§

source§

impl VMGlobalDefinition

source

pub fn new() -> Self

Construct a VMGlobalDefinition.

source

pub fn to_i32(&self) -> i32

Return the value as an i32.

If this is not an I32 typed global it is unspecified what value is returned.

source

pub unsafe fn as_i32_mut(&mut self) -> &mut i32

Return a mutable reference to the value as an i32.

Safety

It is the callers responsibility to make sure the global has I32 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_u32(&self) -> u32

Return a reference to the value as an u32.

If this is not an I32 typed global it is unspecified what value is returned.

source

pub unsafe fn as_u32_mut(&mut self) -> &mut u32

Return a mutable reference to the value as an u32.

Safety

It is the callers responsibility to make sure the global has I32 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_i64(&self) -> i64

Return a reference to the value as an i64.

If this is not an I64 typed global it is unspecified what value is returned.

source

pub unsafe fn as_i64_mut(&mut self) -> &mut i64

Return a mutable reference to the value as an i64.

Safety

It is the callers responsibility to make sure the global has I32 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_u64(&self) -> u64

Return a reference to the value as an u64.

If this is not an I64 typed global it is unspecified what value is returned.

source

pub unsafe fn as_u64_mut(&mut self) -> &mut u64

Return a mutable reference to the value as an u64.

Safety

It is the callers responsibility to make sure the global has I64 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_f32(&self) -> f32

Return a reference to the value as an f32.

If this is not an F32 typed global it is unspecified what value is returned.

source

pub unsafe fn as_f32_mut(&mut self) -> &mut f32

Return a mutable reference to the value as an f32.

Safety

It is the callers responsibility to make sure the global has F32 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_f64(&self) -> f64

Return a reference to the value as an f64.

If this is not an F64 typed global it is unspecified what value is returned.

source

pub unsafe fn as_f64_mut(&mut self) -> &mut f64

Return a mutable reference to the value as an f64.

Safety

It is the callers responsibility to make sure the global has F64 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_funcref(&self) -> VMFuncRef

Return a reference to the value as a VMFuncRef.

If this is not a VMFuncRef typed global it is unspecified what value is returned.

source

pub unsafe fn as_funcref_mut(&mut self) -> &mut VMFuncRef

Return a mutable reference to the value as a VMFuncRef.

Safety

It is the callers responsibility to make sure the global has VMFuncRef type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub unsafe fn as_externref_mut(&mut self) -> &mut VMExternRef

Return a mutable reference to the value as an VMExternRef.

Safety

It is the callers responsibility to make sure the global has I32 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_externref(&self) -> VMExternRef

Return a reference to the value as an VMExternRef.

If this is not an I64 typed global it is unspecified what value is returned.

source

pub fn to_u128(&self) -> u128

Return a reference to the value as an u128.

If this is not an V128 typed global it is unspecified what value is returned.

source

pub unsafe fn as_u128_mut(&mut self) -> &mut u128

Return a mutable reference to the value as an u128.

Safety

It is the callers responsibility to make sure the global has V128 type. Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

source

pub fn to_bytes(&self) -> [u8; 16]

Return a reference to the value as bytes.

source

pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8; 16]

Return a mutable reference to the value as bytes.

Safety

Until the returned borrow is dropped, reads and writes of this global must be done exclusively through this borrow. That includes reads and writes of globals inside wasm functions.

Trait Implementations§

source§

impl Clone for VMGlobalDefinition

source§

fn clone(&self) -> VMGlobalDefinition

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VMGlobalDefinition

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.