Would you be open to adding into_raw() and from_raw() methods to convert between Sender/Receiver values and raw pointers? I think *mut () is correct, but any raw pointer is fine.
AFAICT, the underlying structs just store a pointer from Box::into_raw so this should be an easy to code. I could probably open a PR if needed. However, this does restrict what you can do with the structs in the future.
Use case: I'm a dev on the UniFFI project which generates FFI bindings for foreign languages. I'm testing out using oneshot for async callback interface methods and so far it's working great, except when passing Sender across the FFI as a raw pointer. My current code uses an extra Box, which isn't ideal given that Sender is already a wrapper around a leaked box pointer.
Would you be open to adding
into_raw()
andfrom_raw()
methods to convert betweenSender
/Receiver
values and raw pointers? I think*mut ()
is correct, but any raw pointer is fine.AFAICT, the underlying structs just store a pointer from
Box::into_raw
so this should be an easy to code. I could probably open a PR if needed. However, this does restrict what you can do with the structs in the future.Use case: I'm a dev on the UniFFI project which generates FFI bindings for foreign languages. I'm testing out using
oneshot
for async callback interface methods and so far it's working great, except when passingSender
across the FFI as a raw pointer. My current code uses an extraBox
, which isn't ideal given thatSender
is already a wrapper around a leaked box pointer.