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

#181 in Procedural macros

Download history 1361/week @ 2024-09-21 952/week @ 2024-09-28 614/week @ 2024-10-05 931/week @ 2024-10-12 692/week @ 2024-10-19 671/week @ 2024-10-26 719/week @ 2024-11-02 1081/week @ 2024-11-09 1107/week @ 2024-11-16 1033/week @ 2024-11-23 1306/week @ 2024-11-30 1437/week @ 2024-12-07 1035/week @ 2024-12-14 699/week @ 2024-12-21 676/week @ 2024-12-28 1096/week @ 2025-01-04

3,644 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

~195–690KB
~17K SLoC