-
Notifications
You must be signed in to change notification settings - Fork 135
Closed
Labels
ext/duckdbRelates to the DuckDB integrationRelates to the DuckDB integration
Description
Specifically, impl Clone for Vector can result in a dangling pointer in the "borrowed" version.
A better way to implement bindings might be:
/// An owned DuckDB vector
struct Vector {
ptr: *mut duckdb_vector
}
/// A borrowed DuckDB vector
struct VectorRef<'a> {
ptr: *const duckdb_vector,
_phantom: PhantomData<&'a ()>,
}
impl Vector {
fn as_ref(&self) -> VectorRef<'_> {
...
}
}
impl Drop for Vector {
fn drop(self) {
duckdb_free(self.ptr)
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ext/duckdbRelates to the DuckDB integrationRelates to the DuckDB integration