Convert a zero-sized closure into an extern "C" fn(…)
pointer with the
same1 type signature.
use ::extern_c::extern_c;
let f: extern "C" fn(bool) -> u8 = extern_c(|b: bool| b as u8);
assert_eq!(f(true), 1);
Footnotes
-
but for the ABI, of course! ↩