pub struct MemoryType {
pub memory64: bool,
pub shared: bool,
pub initial: u64,
pub maximum: Option<u64>,
pub page_size_log2: Option<u32>,
}
Expand description
Represents a memory’s type.
Fields§
§memory64: bool
Whether or not this is a 64-bit memory, using i64 as an index. If this is false it’s a 32-bit memory using i32 as an index.
This is part of the memory64 proposal in WebAssembly.
Whether or not this is a “shared” memory, indicating that it should be
send-able across threads and the maximum
field is always present for
valid types.
This is part of the threads proposal in WebAssembly.
initial: u64
Initial size of this memory, in wasm pages.
For 32-bit memories (when memory64
is false
) this is guaranteed to
be at most u32::MAX
for valid types.
maximum: Option<u64>
Optional maximum size of this memory, in wasm pages.
For 32-bit memories (when memory64
is false
) this is guaranteed to
be at most u32::MAX
for valid types. This field is always present for
valid wasm memories when shared
is true
.
page_size_log2: Option<u32>
The log base 2 of the memory’s custom page size.
Memory pages are, by default, 64KiB large (i.e. 216 or
65536
).
The custom-page-sizes proposal allows changing it to other values.
Implementations§
Source§impl MemoryType
impl MemoryType
Sourcepub fn index_type(&self) -> ValType
pub fn index_type(&self) -> ValType
Gets the index type for the memory.
Trait Implementations§
Source§impl Clone for MemoryType
impl Clone for MemoryType
Source§fn clone(&self) -> MemoryType
fn clone(&self) -> MemoryType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MemoryType
impl Debug for MemoryType
Source§impl<'a> FromReader<'a> for MemoryType
impl<'a> FromReader<'a> for MemoryType
Source§fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self>
fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self>
Self
from the provided binary reader, returning an
error if it is unable to do so.Source§impl Hash for MemoryType
impl Hash for MemoryType
Source§impl PartialEq for MemoryType
impl PartialEq for MemoryType
impl Copy for MemoryType
impl Eq for MemoryType
impl StructuralPartialEq for MemoryType
Auto Trait Implementations§
impl Freeze for MemoryType
impl RefUnwindSafe for MemoryType
impl Send for MemoryType
impl Sync for MemoryType
impl Unpin for MemoryType
impl UnwindSafe for MemoryType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.