alef 0.79.0

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if _rc != 0 {
    let msg = if _out_error.is_null() {
        format!("vtable.{{ name }} returned error code {}", _rc)
    } else {
        // SAFETY: out_error was written by the callee as a valid NUL-terminated string.
        let msg = unsafe { std::ffi::CStr::from_ptr(_out_error) }.to_string_lossy().into_owned();
        if let Some(free_fn) = {{ vtable_expr }}.free_string {
            // SAFETY: free_fn is the vtable-provided destructor for callback strings.
            unsafe { free_fn(_out_error) };
        }
        msg
    };
    tracing::warn!(wrapper = "{{ wrapper }}", method = "{{ name }}", error = %msg, "host callback failed; returning default");
    return Default::default();
}