Module cglue::result

source ·
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

Traits

  • Represents an integer-convertable error value.
  • Helper trait for integer errors.

Functions