Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It can be done in 100% safe code as far as Rust is concerned (if you use `dyn Fn` type instead of c_void).

The only unsafe here is to demonstrate it works with C/C++ FFI (where void* userdata is actually not type safe)





Yes but my problem wasn’t with the user data pointer but the fact that I needed a STATIC generic lambda. Static because the C library then forks and continues to call the lambda in the new process but I also type based conversions in it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: