#[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>
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more