Skip to main content

FfiResult

Struct FfiResult 

Source
#[repr(C)]
pub struct FfiResult { pub error_code: FfiErrorCode, pub error_message: FfiString, pub payload: FfiBuffer, }
Expand description

C-ABI result type.

On success: error_code == FfiErrorCode::Ok, error_message is empty, payload contains the result bytes.

On error: error_code != 0, error_message carries a UTF-8 string, payload is zeroed.

Always call ffi_result_free when you are done with the result, regardless of error_code.

Fields§

§error_code: FfiErrorCode§error_message: FfiString§payload: FfiBuffer

Implementations§

Source§

impl FfiResult

Source

pub fn ok(payload: FfiBuffer) -> Self

Construct a successful result carrying payload.

Source

pub fn err(error: FfiError) -> Self

Construct an error result.

Source

pub fn is_ok(&self) -> bool

Returns true if this result represents success.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.