Struct uniffi::RustCallStatus
#[repr(C)]pub struct RustCallStatus {
pub code: RustCallStatusCode,
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 RustCallStatusCode::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 RustCallStatusCode::Error or RustCallStatusCode::UnexpectedError thenerror_buf
will be updated to contain a serialized error object. See RustCallStatusCode for what gets serialized. 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;
};
Fields§
§code: RustCallStatusCode
§error_buf: MaybeUninit<RustBuffer>
Implementations§
§impl RustCallStatus
impl RustCallStatus
pub fn new() -> RustCallStatus
pub fn cancelled() -> RustCallStatus
pub fn error(message: impl Into<String>) -> RustCallStatus
Trait Implementations§
§impl Default for RustCallStatus
impl Default for RustCallStatus
§fn default() -> RustCallStatus
fn default() -> RustCallStatus
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for RustCallStatus
impl Send for RustCallStatus
impl !Sync for RustCallStatus
impl Unpin for RustCallStatus
impl UnwindSafe for RustCallStatus
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more