Skip to main content

return_success

Function return_success 

Source
pub unsafe fn return_success(
    data: Value,
    result_buf: *mut *mut u8,
    result_len: *mut usize,
) -> i32
Expand description

Return a success result to the framework

Serializes data to JSON, allocates a buffer with len == capacity, and writes the pointer and length to the output parameters.

§Safety

result_buf and result_len must point to valid, properly aligned, non-aliased memory that remains valid for the duration of the call.

§Example

unsafe {
    let result = json!({"status": "ok"});
    return return_success(result, result_buf, result_len);
}