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

#177 in Procedural macros

Download history 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 1138/week @ 2024-11-29 1568/week @ 2024-12-06 1049/week @ 2024-12-13 717/week @ 2024-12-20 643/week @ 2024-12-27 1118/week @ 2025-01-03 2226/week @ 2025-01-10 1593/week @ 2025-01-17 2304/week @ 2025-01-24

7,376 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
~18K SLoC