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

#701 in Procedural macros

Download history 117/week @ 2024-03-14 91/week @ 2024-03-21 72/week @ 2024-03-28 95/week @ 2024-04-04 194/week @ 2024-04-11 151/week @ 2024-04-18 936/week @ 2024-04-25 1314/week @ 2024-05-02 6003/week @ 2024-05-09 4405/week @ 2024-05-16 6840/week @ 2024-05-23 5254/week @ 2024-05-30 1013/week @ 2024-06-06 773/week @ 2024-06-13 1003/week @ 2024-06-20 522/week @ 2024-06-27

3,629 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
~35K SLoC