#[repr(C)]
pub struct VMMemoryDefinition { pub base: *mut u8, pub current_length: AtomicUsize, }
Expand description

The fields compiled code needs to access to utilize a WebAssembly linear memory defined within the instance, namely the start address and the size in bytes.

Fields

base: *mut u8

The start address.

current_length: AtomicUsize

The current logical size of this linear memory in bytes.

This is atomic because shared memories must be able to grow their length atomically. For relaxed access, see VMMemoryDefinition::current_length().

Implementations

Return the current length of the VMMemoryDefinition by performing a relaxed load; do not use this function for situations in which a precise length is needed. Owned memories (i.e., non-shared) will always return a precise result (since no concurrent modification is possible) but shared memories may see an imprecise value–a current_length potentially smaller than what some other thread observes. Since Wasm memory only grows, this under-estimation may be acceptable in certain cases.

Return a copy of the VMMemoryDefinition using the relaxed value of current_length; see VMMemoryDefinition::current_length().

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.