Skip to main content

error_set_c

Function error_set_c 

Source
pub unsafe fn error_set_c(
    out_err: *mut FfiError,
    code: i32,
    message: *const c_char,
)
Expand description

The body of {prefix}_error_set: fill out_err from a borrowed C string the consumer owns.

Callback-interface implementations call it to report a failure so that the message is allocated by the producer, which is the side that frees it. A null or non-UTF-8 message yields an empty message; the code is always recorded.

ยงSafety

Same contract as error_set for out_err. message must be null or point to a NUL-terminated string that stays valid for the call.