pub struct VMMemory {
pub from: Arc<dyn Memory>,
pub instance_ref: Option<WeakOrStrongInstanceRef>,
}
Expand description
A memory export value.
Fields§
§from: Arc<dyn Memory>
Pointer to the containing Memory
.
instance_ref: Option<WeakOrStrongInstanceRef>
A “reference” to the instance through the
InstanceRef
. None
if it is a host memory.
Implementations§
Source§impl VMMemory
impl VMMemory
Sourcepub fn ty(&self) -> MemoryType
pub fn ty(&self) -> MemoryType
Get the type for this exported memory
Sourcepub fn style(&self) -> &MemoryStyle
pub fn style(&self) -> &MemoryStyle
Get the style for this exported memory
Sourcepub fn same(&self, other: &Self) -> bool
pub fn same(&self, other: &Self) -> bool
Returns whether or not the two VMMemory
s refer to the same Memory.
Sourcepub fn upgrade_instance_ref(&mut self) -> Option<()>
pub fn upgrade_instance_ref(&mut self) -> Option<()>
Converts the stored instance ref into a strong InstanceRef
if it is weak.
Returns None if it cannot be upgraded.
Trait Implementations§
impl Send for VMMemory
§Safety
This is correct because there is no non-threadsafe logic directly in this type;
correct use of the raw memory from multiple threads via definition
requires unsafe
and is the responsibilty of the user of this type.
impl Sync for VMMemory
§Safety
This is correct because the values directly in definition
should be considered immutable
and the type is both Send
and Clone
(thus marking it Sync
adds no new behavior, it
only makes this type easier to use)