Struct uniffi::ffi::rustcalls::RustCallStatus [−][src]
#[repr(C)]pub struct RustCallStatus { pub code: i8, pub error_buf: MaybeUninit<RustBuffer>, }
Expand description
Represents the success/error of a rust call
Usage
- The consumer code creates a
RustCallStatus
with an emptyRustBuffer
andCALL_SUCCESS
(0) as the status code - A pointer to this object is passed to the rust FFI function. This is an “out parameter” which will be updated with any error that occurred during the function’s execution.
- After the call, if
code
isCALL_ERROR
thenerror_buf
will be updated to contain the serialized error object. The consumer is responsible for freeingerror_buf
.
Layout/fields
The layout of this struct is important since consumers on the other side of the FFI need to construct it. If this were a C struct, it would look like:
struct RustCallStatus { int8_t code; RustBuffer error_buf; };
The code
field.
CALL_SUCCESS
(0) for successful callsCALL_ERROR
(1) for calls that returned anErr
valueCALL_PANIC
(2) for calls that panicked
The error_buf
field.
- For
CALL_ERROR
this is aRustBuffer
with the serialized error. The consumer code is responsible for freeing thisRustBuffer
.
Fields
code: i8
error_buf: MaybeUninit<RustBuffer>