[][src]Macro ocaml_interop::to_ocaml

macro_rules! to_ocaml {
    ($gc:ident, $obj:expr) => { ... };
}

Converts Rust values into OCaml values.

In to_ocaml!(gc, value), gc is an OCaml frame GC handle, and value is a Rust value of a type that implements the ToOCaml trait. The resulting value's lifetime is bound to gc's.

Examples

    ocaml_frame!(gc, {
        let ocaml_string: OCaml<String> = to_ocaml!(gc, "hello OCaml!");
        // ...
    });