mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 06:45:44 +00:00
Contracts: Memory and Module instance teardowns (#171)
* Add teardowns. * Rebuild binaries.
This commit is contained in:
committed by
Gav Wood
parent
f3284e964a
commit
5f9aca2137
@@ -76,9 +76,12 @@ mod ffi {
|
||||
val_ptr: *const u8,
|
||||
val_len: usize,
|
||||
) -> u32;
|
||||
|
||||
// TODO: ext_instance_teardown
|
||||
// TODO: ext_memory_teardown
|
||||
pub fn ext_sandbox_memory_teardown(
|
||||
memory_idx: u32,
|
||||
);
|
||||
pub fn ext_sandbox_instance_teardown(
|
||||
instance_idx: u32,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +125,14 @@ impl Memory {
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Memory {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
ffi::ext_sandbox_memory_teardown(self.memory_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct EnvironmentDefinitionBuilder<T> {
|
||||
env_def: sandbox_primitives::EnvironmentDefinition,
|
||||
_marker: marker::PhantomData<T>,
|
||||
@@ -265,3 +276,11 @@ impl<T> Instance<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Drop for Instance<T> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
ffi::ext_sandbox_instance_teardown(self.instance_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user