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
sourceimpl 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
sourceimpl MemoryUsage for VMMemory
impl MemoryUsage for VMMemory
sourcefn size_of_val(&self, visited: &mut dyn MemoryUsageTracker) -> usize
fn size_of_val(&self, visited: &mut dyn MemoryUsageTracker) -> usize
Returns the size of the referenced value in bytes. Read more
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)
Auto Trait Implementations
Blanket Implementations
impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
sourceimpl<T> Upcastable for T where
T: 'static + Any + Send + Sync,
impl<T> Upcastable for T where
T: 'static + Any + Send + Sync,
sourcefn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
sourcefn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref