[][src]Attribute Macro ocaml_derive::ocaml_func

#[ocaml_func]

func is used export Rust functions to OCaml, performing the necessary wrapping/unwrapping automatically.

  • Wraps the function body using ocaml::body
  • Automatic type conversion for arguments/return value (including Result types)
  • Defines a bytecode function automatically for functions that take more than 5 arguments. The bytecode function for my_func would be my_func_bytecode