Module cglue::result[][src]

Expand description

FFI safe result.

This module contains several key parts:

CResult

It is a simple #[repr(C)] enum that is equivalent and interchangeable with Result.

IntError

IntError is a type that allows for efficient FFI-boundary crossing and simple interop with C code. It takes a Result<T, E>, and splits it up to 2 distinct parts

  • ok_out pointer, and an integer return value. Value of zero always means success, and that ok_out was filled, whereas any other value can represent a specific meaning E must specify by itself.

IntResult

It is a helper trait that is implemented on all Result<T, E> types where E implements IntError.

Enums

FFI safe result.

Traits

Represents an integer-convertable error value.

Helper trait for integer errors.

Functions

Convert from error code to concrete result.

Convert from error code to Ok or Err.

Convert result into an integer error value, potentially writing the Ok value.

Convert result into an integer error value.