Attribute Macro ocaml::func

source · []
#[func]
Expand description

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
  • Allows for an optional ident argument specifying the name of the gc handle parameter