[][src]Struct c_bridge::FfiResult

#[repr(C)]
pub struct FfiResult<T, E> {
    pub dealloc: unsafe extern "C" fn(_: *mut Self),
    pub into_ok: unsafe extern "C" fn(_: *mut Self) -> T,
    pub into_err: unsafe extern "C" fn(_: *mut Self) -> E,
    pub is_ok: unsafe extern "C" fn(_: *const Self) -> u8,
    pub object: *mut c_void,
}

A FFI-compatible result type

Fields

dealloc: unsafe extern "C" fn(_: *mut Self)

The deallocator

into_ok: unsafe extern "C" fn(_: *mut Self) -> T

Consumes the object and returns the underlying result

into_err: unsafe extern "C" fn(_: *mut Self) -> E

Consumes the object and returns the underlying error

is_ok: unsafe extern "C" fn(_: *const Self) -> u8

Indicates if the result is ok (1) or if it contains an error (0)

object: *mut c_void

The underlying object (implementation dependent)

Methods

impl<T, E> FfiResult<T, E>[src]

pub fn into_result(self) -> Result<T, E>[src]

Converts self into a Rust result

pub fn map<R>(self, f: impl FnOnce(T) -> R) -> Result<R, E>[src]

Maps the Ok-variant of the result

pub fn map_err<R>(self, f: impl FnOnce(E) -> R) -> Result<T, R>[src]

Maps the Err-variant of the result

Trait Implementations

impl<T, E> Drop for FfiResult<T, E>[src]

impl<T, E> Into<Result<T, E>> for FfiResult<T, E>[src]

impl<T, E> From<Result<T, E>> for FfiResult<T, E>[src]

Auto Trait Implementations

impl<T, E> !Send for FfiResult<T, E>

impl<T, E> !Sync for FfiResult<T, E>

impl<T, E> Unpin for FfiResult<T, E>

impl<T, E> UnwindSafe for FfiResult<T, E>

impl<T, E> RefUnwindSafe for FfiResult<T, E>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]