Add impls for dropping RustString/RustVec ffi wrappers
diff --git a/src/rust_vec.rs b/src/rust_vec.rs
index c88804a..8443043 100644
--- a/src/rust_vec.rs
+++ b/src/rust_vec.rs
@@ -4,6 +4,7 @@
use core::ffi::c_void;
use core::marker::PhantomData;
use core::mem::{self, ManuallyDrop, MaybeUninit};
+use core::ptr;
// ABI compatible with C++ rust::Vec<T> (not necessarily alloc::vec::Vec<T>).
#[repr(C)]
@@ -99,3 +100,9 @@
unsafe { &mut *(self as *mut RustVec<RustString> as *mut Vec<String>) }
}
}
+
+impl<T> Drop for RustVec<T> {
+ fn drop(&mut self) {
+ unsafe { ptr::drop_in_place(self.as_mut_vec()) }
+ }
+}