pub struct LinearMemory { /* private fields */ }Expand description
A linear memory instance.
Implementations§
Source§impl 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_locationmust point to a valid location in VM memory.
Source§impl LinearMemory
impl LinearMemory
Sourcepub fn ty(&self) -> MemoryType
pub fn ty(&self) -> MemoryType
Returns the type for this memory.
Sourcepub fn style(&self) -> &MemoryStyle
pub fn style(&self) -> &MemoryStyle
Returns the memory style for this memory.
Sourcepub fn grow(&self, delta: Pages) -> Result<Pages, MemoryError>
pub 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.
Sourcepub fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
pub fn vmmemory(&self) -> NonNull<VMMemoryDefinition>
Return a VMMemoryDefinition for exposing the memory to compiled wasm code.
Trait Implementations§
Source§impl Debug for LinearMemory
impl Debug for LinearMemory
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§
impl !Freeze for LinearMemory
impl !RefUnwindSafe for LinearMemory
impl Unpin for LinearMemory
impl UnwindSafe for LinearMemory
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.