@kornel It's not specifically useful for passing *over* FFI boundaries, but it allows the construction of safe APIs that wrap FFI and go to and from the same functor on either end.
Top-level
@kornel It's not specifically useful for passing *over* FFI boundaries, but it allows the construction of safe APIs that wrap FFI and go to and from the same functor on either end. 2 comments
@kornel Also, I can't just remember the function pointer in the enclosing scope: the code I'm writing relies on the final trampoline being a tail call, so any data left in the function body needs to go unused. I know it seems like a niche case, but this is, I think, the third time (in totally unrelated circumstances) I've wanted to reach for such an API |
@kornel Right now, the best approach I have is to have a `assert!(size_of::<F>() == 0);` inside the API and then do an ugly transmute out of thin air on the other side, which I'm certain is at least partially unsound (depending on decisions about whether fn pointers have provenance)