Crates.io | extern-c |
lib.rs | extern-c |
version | 0.1.1-rc1 |
source | src |
created_at | 2023-09-05 19:41:49.916999 |
updated_at | 2023-09-07 15:37:40.933903 |
description | Convert a zero-sized closure into an `extern "C" fn(…)` pointer |
homepage | |
repository | https://github.com/danielhenrymantilla/extern-c.rs |
max_upload_size | |
id | 964735 |
size | 32,857 |
::extern-c
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);
but for the ABI, of course! ↩