ocaml_sys/
custom.rs

1use crate::*;
2
3use mlvalues::{Intnat, Size, Uintnat};
4
5#[repr(C)]
6#[derive(Debug, Copy, Clone)]
7pub struct custom_fixed_length {
8    pub bsize_32: Intnat,
9    pub bsize_64: Intnat,
10}
11#[repr(C)]
12#[derive(Debug, Copy, Clone)]
13pub struct custom_operations {
14    pub identifier: *const Char,
15    pub finalize: ::core::option::Option<unsafe extern "C" fn(v: Value)>,
16    pub compare: ::core::option::Option<unsafe extern "C" fn(v1: Value, v2: Value) -> i32>,
17    pub hash: ::core::option::Option<unsafe extern "C" fn(v: Value) -> Intnat>,
18    pub serialize: ::core::option::Option<
19        unsafe extern "C" fn(v: Value, bsize_32: *mut Uintnat, bsize_64: *mut Uintnat),
20    >,
21    pub deserialize:
22        ::core::option::Option<unsafe extern "C" fn(dst: *mut ::core::ffi::c_void) -> Uintnat>,
23    pub compare_ext: ::core::option::Option<unsafe extern "C" fn(v1: Value, v2: Value) -> i32>,
24    pub fixed_length: *const custom_fixed_length,
25}
26extern "C" {
27    pub fn caml_alloc_custom(
28        ops: *const custom_operations,
29        size: Uintnat,
30        mem: Size,
31        max: Size,
32    ) -> Value;
33}
34extern "C" {
35    pub fn caml_alloc_custom_mem(ops: *mut custom_operations, size: Uintnat, mem: Size) -> Value;
36}
37extern "C" {
38    pub fn caml_register_custom_operations(ops: *mut custom_operations);
39}