pub unsafe fn callback_exn(f: Value, arg: Value) -> Result<Value, Error> {
    let f_block = match ocamlrep::Value::from_bits(f).as_block() {
        Some(block) => block,
        None => return Err(Error::NotInvokable),
    };
    if f_block.tag() != CLOSURE_TAG {
        return Err(Error::NotInvokable);
    }
    let res = caml_callback_exn(f, arg);

    if is_exception_result(res) {
        Err(Error::Exception(extract_exception(res)))
    } else {
        Ok(res)
    }
}
/// Call a closure with a single argument.
///
/// # Safety
///
/// The calling thread must be known to the OCaml runtime system. Threads
/// created from OCaml (via `Thread.create`) and the main thread are
/// automatically known to the runtime system. See the [OCaml manual] for more
/// details.
///
/// [OCaml manual]: (https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#s:C-multithreading)
Call a closure with a single argument.
Call a closure with a single argument .
pub unsafe fn callback_exn(f: Value, arg: Value) -> Result<Value, Error> {
    let f_block = match ocamlrep::Value::from_bits(f).as_block() {
        Some(block) => block,
        None => return Err(Error::NotInvokable),
    };
    if f_block.tag() != CLOSURE_TAG {
        return Err(Error::NotInvokable);
    }
    let res = caml_callback_exn(f, arg);
    if is_exception_result(res) {
        Err(Error::Exception(extract_exception(res)))
    } else {
        Ok(res)
    }
}
pub unsafe fn callback_exn ( f : Value , arg : Value ) -> Result < Value , Error > { let f_block = match ocamlrep :: Value :: from_bits ( f ) . as_block ( ) { Some ( block ) => block , None => return Err ( Error :: NotInvokable ) , } ; if f_block . tag ( ) != CLOSURE_TAG { return Err ( Error :: NotInvokable ) ; } let res = caml_callback_exn ( f , arg ) ; if is_exception_result ( res ) { Err ( Error :: Exception ( extract_exception ( res ) ) ) } else { Ok ( res ) } }
Call a closure with a single argument.
Call a closure with a single argument .
f
Value
arg
Value
f
Value
arg
Value
safety
The calling thread must be known to the OCaml runtime system. Threads
created from OCaml (via `Thread.create`) and the main thread are
automatically known to the runtime system. See the [OCaml manual] for more
details.

[OCaml manual].
The calling thread must be known to the OCaml runtime system . Threads created from OCaml ( via ` Thread . create ` ) and the main thread are automatically known to the runtime system . See the [ OCaml manual ] for more details . [ OCaml manual ] .