Struct wasmtime_runtime::SharedMemory
source · [−]pub struct SharedMemory(_);
Expand description
For shared memory (and only for shared memory), this lock-version restricts
access when growing the memory or checking its size. This is to conform with
the thread proposal: “When IsSharedArrayBuffer(...)
is true, the return
value should be the result of an atomic read-modify-write of the new size to
the internal length
slot.”
Implementations
sourceimpl SharedMemory
impl SharedMemory
sourcepub fn new(plan: MemoryPlan) -> Result<Self>
pub fn new(plan: MemoryPlan) -> Result<Self>
Construct a new SharedMemory
.
sourcepub fn wrap(
plan: &MemoryPlan,
memory: Box<dyn RuntimeLinearMemory>,
ty: Memory
) -> Result<Self>
pub fn wrap(
plan: &MemoryPlan,
memory: Box<dyn RuntimeLinearMemory>,
ty: Memory
) -> Result<Self>
Wrap an existing Memory with the locking provided by a SharedMemory.
sourcepub fn ty(&self) -> Memory
pub fn ty(&self) -> Memory
Return the memory type for this SharedMemory
.
sourcepub fn vmmemory_ptr_mut(&mut self) -> *mut VMMemoryDefinition
pub fn vmmemory_ptr_mut(&mut self) -> *mut VMMemoryDefinition
Return a mutable pointer to the shared memory’s VMMemoryDefinition.
sourcepub fn vmmemory_ptr(&self) -> *const VMMemoryDefinition
pub fn vmmemory_ptr(&self) -> *const VMMemoryDefinition
Return a pointer to the shared memory’s VMMemoryDefinition.
Trait Implementations
sourceimpl Clone for SharedMemory
impl Clone for SharedMemory
sourcefn clone(&self) -> SharedMemory
fn clone(&self) -> SharedMemory
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl RuntimeLinearMemory for SharedMemory
impl RuntimeLinearMemory for SharedMemory
Proxy all calls through the RwLock
.
sourcefn maximum_byte_size(&self) -> Option<usize>
fn maximum_byte_size(&self) -> Option<usize>
Returns the maximum number of bytes the memory can grow to.
Returns None
if the memory is unbounded. Read more
sourcefn grow(
&mut self,
delta_pages: u64,
store: Option<&mut dyn Store>
) -> Result<Option<(usize, usize)>, Error>
fn grow(
&mut self,
delta_pages: u64,
store: Option<&mut dyn Store>
) -> Result<Option<(usize, usize)>, Error>
Grows a memory by delta_pages
. Read more
sourcefn grow_to(&mut self, size: usize) -> Result<()>
fn grow_to(&mut self, size: usize) -> Result<()>
Grow memory to the specified amount of bytes. Read more
sourcefn vmmemory(&mut self) -> VMMemoryDefinition
fn vmmemory(&mut self) -> VMMemoryDefinition
Return a VMMemoryDefinition
for exposing the memory to compiled wasm
code. Read more
sourcefn needs_init(&self) -> bool
fn needs_init(&self) -> bool
Does this memory need initialization? It may not if it already
has initial contents courtesy of the MemoryImage
passed to
RuntimeMemoryCreator::new_memory()
. Read more
sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
For the pooling allocator, we must be able to downcast this trait to its underlying structure. Read more
Auto Trait Implementations
impl RefUnwindSafe for SharedMemory
impl Send for SharedMemory
impl Sync for SharedMemory
impl Unpin for SharedMemory
impl UnwindSafe for SharedMemory
Blanket Implementations
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more