ffi: implement explicit point deletion

This commit is contained in:
2025-11-12 23:40:13 +01:00
parent 29e7e59ffb
commit 3c66a49bb0
+13
View File
@@ -51,6 +51,19 @@ mod ffi_point {
(x, y, z) (x, y, z)
} }
} }
pub fn delete(mut self) -> Result<(), &'static str> {
unsafe {
if self.ptr.is_null() {
return Err("Error: Attempted to delete null pointer");
}
delete_point(self.ptr);
self.ptr = std::ptr::null_mut();
std::mem::forget(self);
}
Ok(())
}
} }
impl Drop for Point { impl Drop for Point {