mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 22:28:21 +00:00
Move all vm internals out
This commit is contained in:
15
lib/api/src/externals/memory.rs
vendored
15
lib/api/src/externals/memory.rs
vendored
@@ -143,6 +143,21 @@ impl Memory {
|
||||
}
|
||||
|
||||
/// Attempts to clone this memory (if its clonable) in a new store
|
||||
pub fn clone_in_store(
|
||||
&self,
|
||||
store: &impl AsStoreRef,
|
||||
new_store: &mut impl AsStoreMut,
|
||||
) -> Option<Self> {
|
||||
if !self.ty(store).shared {
|
||||
// We should only be able to duplicate in a new store if the memory is shared
|
||||
return None;
|
||||
}
|
||||
self.0
|
||||
.try_clone(&store)
|
||||
.map(|new_memory| Self::new_from_existing(new_store, new_memory.into()))
|
||||
}
|
||||
|
||||
/// Attempts to duplicate this memory (if its clonable) in a new store
|
||||
pub fn duplicate_in_store(
|
||||
&self,
|
||||
store: &impl AsStoreRef,
|
||||
|
||||
Reference in New Issue
Block a user