6 releases (1 stable)

1.0.0 Aug 30, 2024
1.0.0-beta.4 Oct 24, 2022
1.0.0-beta.3 Aug 7, 2022
1.0.0-beta.1 Jul 29, 2022
1.0.0-beta.0 Jun 6, 2022

#178 in Procedural macros

Download history 852/week @ 2024-08-16 1366/week @ 2024-08-23 1154/week @ 2024-08-30 939/week @ 2024-09-06 702/week @ 2024-09-13 1165/week @ 2024-09-20 1096/week @ 2024-09-27 676/week @ 2024-10-04 696/week @ 2024-10-11 924/week @ 2024-10-18 659/week @ 2024-10-25 709/week @ 2024-11-01 1059/week @ 2024-11-08 894/week @ 2024-11-15 1266/week @ 2024-11-22 1125/week @ 2024-11-29

4,463 downloads per month

ISC license

11KB
232 lines

ocaml-build

ocaml-build is used to generate an OCaml file containing signatures from Rust code

For example, if you have this function (annotated with the #[ocaml::sig(...)] macro:

#[ocaml::func]
#[ocaml::sig("int -> bool")]
pub fn greater_than_zero(i: ocaml::Int) -> bool {
  i > 0
}

And the following build script:

fn main() -> std::io::Result<()> {
    ocaml_build::Sigs::new("src/rust.ml").generate()
}

The following code will be generated in src/rust.ml:

external greater_than_zero: int -> bool = "greater_than_zero"

And a matching mli file will be created.

Dependencies

~225–730KB
~17K SLoC