Crate ocaml [] [src]

ocaml-rs is a library for directly interacting with the C OCaml runtime, in Rust. Consquently, ocaml is designed for rust shared objects that expose raw C FFI bindings, which are then either statically or dynamically linked against an OCaml binary, which calls into these raw FFI bindings as if they were regular, so-called "C stubs". Similarly, any OCaml runtime functions, such as caml_string_length, will get their definition from the final OCaml binary, with its associated runtime.

Reexports

pub use value::ToValue;
pub use value::FromValue;
pub use value::Value;

Modules

conv
core
value

Macros

array

Create an OCaml array

bp_val

Pointer to the first byte

caml

Defines an external Rust function for FFI use by an OCaml program, with automatic CAMLparam, CAMLlocal, and CAMLreturn inserted for you.

caml_body

Defines an OCaml FFI body, including any locals, as well as a return if provided; it is up to you to define the parameters.

caml_ffi
caml_local

Initializes and registers the given identifier(s) as a local value with the OCaml runtime.

caml_param

Registers OCaml parameters with the GC

extract_exception
field

Extracts from the $block an OCaml value at the $ith-field

int_val

Converts an OCaml int into a usize

is_exception_result
list

Create an OCaml list

long_val

Long_val(x) ((x) >> 1)

make_exception_result
return0

Returns an OCaml unit value

store_field

Stores the $val at $offset in the $block.

string_val

Extracts a machine ptr to the bytes making up an OCaml string

tag_val
tuple

Create an OCaml tuple

val_int

Converts a machine usize into an OCaml int

val_long

(((intnat)(x) << 1) + 1)

Structs

Array

OCaml Array type

List

OCaml list type

Str

OCaml String type

Tuple

OCaml Tuple type

Enums

Error

Error returned by ocaml-rs functions

Tag

Tags are used to determine the type of value that is stored in an OCaml value

Functions

named_value

Returns a named value registered by OCaml