extern-c

Crates.ioextern-c
lib.rsextern-c
version0.1.1-rc1
sourcesrc
created_at2023-09-05 19:41:49.916999
updated_at2023-09-07 15:37:40.933903
descriptionConvert a zero-sized closure into an `extern "C" fn(…)` pointer
homepage
repositoryhttps://github.com/danielhenrymantilla/extern-c.rs
max_upload_size
id964735
size32,857
Daniel Henry-Mantilla (danielhenrymantilla)

documentation

https://docs.rs/extern-c

README

::extern-c

Convert a zero-sized closure into an extern "C" fn(…) pointer with the same1 type signature.

Repository Latest version Documentation MSRV no_std compatible License CI

Example

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

  1. but for the ABI, of course!

Commit count: 4

cargo fmt