Skip to main content

error_set_payload_c

Function error_set_payload_c 

Source
pub unsafe fn error_set_payload_c(
    out_err: *mut FfiError,
    ptr: *const u8,
    len: usize,
)
Expand description

The body of {prefix}_error_set_payload: replace out_err’s payload with a producer-owned copy of the len bytes at ptr. A null out_err is a no-op; a null ptr (or a len of 0) clears the payload.

A callback-interface implementation of a throws method calls it after {prefix}_error_set to attach a domain code’s fields, encoded as a value buffer, so the producer can decode the typed error.

§Safety

Same contract as error_set for out_err. ptr must be null or point to len readable bytes for the duration of the call.