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

#219 in Procedural macros

Download history 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 1119/week @ 2025-01-04 2661/week @ 2025-01-11 1296/week @ 2025-01-18 2941/week @ 2025-01-25 2154/week @ 2025-02-01 2297/week @ 2025-02-08 1769/week @ 2025-02-15 1732/week @ 2025-02-22 3770/week @ 2025-03-01 2585/week @ 2025-03-08 2118/week @ 2025-03-15

10,544 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

~200–690KB
~16K SLoC