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 empty RustBuffer and CALL_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 is CALL_ERROR then error_buf will be updated to contain the serialized error object. The consumer is responsible for freeing error_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 calls
  • CALL_ERROR (1) for calls that returned an Err value
  • CALL_PANIC (2) for calls that panicked

The error_buf field.

  • For CALL_ERROR this is a RustBuffer with the serialized error. The consumer code is responsible for freeing this RustBuffer.

Fields

code: i8error_buf: MaybeUninit<RustBuffer>

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.