Follow @brainblasted In the `parent_XXX` functions? All those lines are unsafe, they do C/Rust translation in both directions and work on raw pointers. They have to poke into the C structs for finding the function pointer, then convert all the Rust types to something C can handle (raw pointers, enums to integers, etc), then call the C function pointer, then convert any return values (or out parameters) back to the corresponding Rust types. Each of these steps is unsafe.

They're the other side of the `unsafe extern` trampoline functions at the end of the file, which are called from C, have to do the FFI translations, call the Rust code, translate back to whatever C wants.

Sign in to participate in the conversation

On the internet, everyone knows you're a cat — and that's totally okay.