Crates.io | ocaml-build |
lib.rs | ocaml-build |
version | 1.0.0 |
source | src |
created_at | 2022-06-06 16:15:59.212998 |
updated_at | 2024-08-30 03:29:33.643605 |
description | OCaml code generation |
homepage | |
repository | https://github.com/zshipko/ocaml-rs |
max_upload_size | |
id | 600808 |
size | 10,477 |
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.