ocaml-build

Crates.ioocaml-build
lib.rsocaml-build
version1.0.0
sourcesrc
created_at2022-06-06 16:15:59.212998
updated_at2024-08-30 03:29:33.643605
descriptionOCaml code generation
homepage
repositoryhttps://github.com/zshipko/ocaml-rs
max_upload_size
id600808
size10,477
zach (zshipko)

documentation

https://docs.rs/ocaml-build

README

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.

Commit count: 490

cargo fmt