frida / frida-rust

Frida Rust bindings
Other
185 stars 52 forks source link

Implement standard traits for NativePointer #82

Closed fabianfreyer closed 1 year ago

fabianfreyer commented 1 year ago

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.

meme commented 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?

fabianfreyer commented 1 year ago

The ergonomics I'm missing are:

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.

fabianfreyer commented 1 year ago

Thank you!