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

#176 in Procedural macros

Download history 1070/week @ 2024-07-29 1002/week @ 2024-08-05 847/week @ 2024-08-12 1029/week @ 2024-08-19 1509/week @ 2024-08-26 978/week @ 2024-09-02 886/week @ 2024-09-09 584/week @ 2024-09-16 1418/week @ 2024-09-23 979/week @ 2024-09-30 616/week @ 2024-10-07 963/week @ 2024-10-14 669/week @ 2024-10-21 693/week @ 2024-10-28 718/week @ 2024-11-04 1084/week @ 2024-11-11

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

~240–750KB
~18K SLoC