5 releases

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

#984 in Procedural macros

Download history 5581/week @ 2023-12-01 5113/week @ 2023-12-08 6135/week @ 2023-12-15 1844/week @ 2023-12-22 1729/week @ 2023-12-29 2351/week @ 2024-01-05 1826/week @ 2024-01-12 1934/week @ 2024-01-19 2125/week @ 2024-01-26 1326/week @ 2024-02-02 167/week @ 2024-02-09 1082/week @ 2024-02-16 230/week @ 2024-02-23 148/week @ 2024-03-01 151/week @ 2024-03-08 86/week @ 2024-03-15

669 downloads per month

ISC license

11KB
228 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

~1.5MB
~34K SLoC