Struct wasmer_vm::LinearMemory
source · [−]pub struct LinearMemory { /* private fields */ }
Expand description
A linear memory instance.
Implementations
sourceimpl LinearMemory
impl LinearMemory
sourcepub fn new(
memory: &MemoryType,
style: &MemoryStyle
) -> Result<Self, MemoryError>
pub fn new(
memory: &MemoryType,
style: &MemoryStyle
) -> Result<Self, MemoryError>
Create a new linear memory instance with specified minimum and maximum number of wasm pages.
This creates a LinearMemory
with owned metadata: this can be used to create a memory
that will be imported into Wasm modules.
sourcepub unsafe fn from_definition(
memory: &MemoryType,
style: &MemoryStyle,
vm_memory_location: NonNull<VMMemoryDefinition>
) -> Result<Self, MemoryError>
pub unsafe fn from_definition(
memory: &MemoryType,
style: &MemoryStyle,
vm_memory_location: NonNull<VMMemoryDefinition>
) -> Result<Self, MemoryError>
Create a new linear memory instance with specified minimum and maximum number of wasm pages.
This creates a LinearMemory
with metadata owned by a VM, pointed to by
vm_memory_location
: this can be used to create a local memory.
Safety
vm_memory_location
must point to a valid location in VM memory.
Trait Implementations
sourceimpl Debug for LinearMemory
impl Debug for LinearMemory
sourceimpl Memory for LinearMemory
impl Memory for LinearMemory
sourcefn ty(&self) -> MemoryType
fn ty(&self) -> MemoryType
Returns the type for this memory.
sourcefn style(&self) -> &MemoryStyle
fn style(&self) -> &MemoryStyle
Returns the memory style for this memory.
sourcefn grow(&self, delta: Pages) -> Result<Pages, MemoryError>
fn grow(&self, delta: Pages) -> Result<Pages, MemoryError>
Grow memory by the specified amount of wasm pages.
Returns None
if memory can’t be grown by the specified amount
of wasm pages.
sourcefn vmmemory(&self) -> NonNull<VMMemoryDefinition>
fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
Return a VMMemoryDefinition
for exposing the memory to compiled wasm code.
sourceimpl MemoryUsage for LinearMemory
impl MemoryUsage for LinearMemory
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 LinearMemory
We must implement this because of VMMemoryDefinitionOwnership::VMOwned
.
This is correct because synchronization of memory accesses is controlled
by the VM.
impl Sync for LinearMemory
This is correct because all internal mutability is protected by a mutex.
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