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

#174 in Procedural macros

Download history 1112/week @ 2024-11-17 1024/week @ 2024-11-24 1297/week @ 2024-12-01 1455/week @ 2024-12-08 1044/week @ 2024-12-15 668/week @ 2024-12-22 688/week @ 2024-12-29 1118/week @ 2025-01-05 2655/week @ 2025-01-12 1651/week @ 2025-01-19 2624/week @ 2025-01-26 2203/week @ 2025-02-02 2221/week @ 2025-02-09 1804/week @ 2025-02-16 1762/week @ 2025-02-23 3717/week @ 2025-03-02

9,660 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

~180–670KB
~16K SLoC