Closed fabianfreyer closed 1 year ago
In many ways, the intention was to not derive these traits so that it could not be interchanged with a *mut c_void
.
Is there a specific helper function on NativePointer that addresses your issue instead? What is the ergonomics issue you are having with NativePointer?
The ergonomics I'm missing are:
NativePointer
into a closure, because there is no way to clone or copy a NativePointer
, and repeating the code to get the corresponding pointer, e.g. doing symbol lookups for every instance I need would add significant overhead. Currently, my code is full of calling NativePointer(other.0)
because *mut c_void
implements Copy.I'm not really sure what is gained by not deriving these traits.
The #[repr(transparent)]
is useful for std::mem::transmute
, e.g. to be able to transmute to function pointers.
Thank you!
Implement Copy, Clone, Hash, and Eq for NativePointers. Additionally, make NativePointer #[repr(transparent)], so it can be used in FFI just like the underlying
*mut c_void
.