[−][src]Macro ocaml_interop::ocaml_unpack_record
Unpacks an OCaml record into a Rust record
It is important that the order remains the same as in the OCaml type declaration.
Examples
struct MyStruct { int_field: i64, string_field: String, } // Assuming an OCaml record declaration like: // // type my_struct = { // int_field: int; // string_field: string; // } // // NOTE: What is important is the order of the fields, not their names. let ocaml_struct = ocaml_call!(make_mystruct(gc, OCaml::unit())).unwrap(); ocaml_unpack_record! { // value => RustConstructor { field: OCamlType, ... } ocaml_struct => MyStruct { int_field: OCamlInt, string_field: String, } }