Crate ffi_utils

source ·
Expand description

FFI utilities

Re-exports

pub use self::string::from_c_str;
pub use self::string::StringError;

Modules

Utilities for binding generators.
Helpers to work with extern “C” callbacks.
Utilities for passing strings across FFI boundaries.
Test utilities.

Macros

Converts a result into a pair of (error_code: i32, description: CString) to be used in FfiResult
Converts a result into a pair of (error_code: i32, description: CString) to be used in FfiResult

Structs

FFI result wrapper.
Type that holds opaque user data handed into FFI functions.

Constants

Constant value to be used for OK result.

Traits

Trait for types that can be converted to integer error code.
Trait to convert between FFI and Rust representations of types
Provides FFI-safe pointers, as opposed to raw as_ptr() in Vec and String which can return values such as 0x01 that can cause segmentation faults with the automatic pointer dereferencing on the front-end side (e.g. in Node.js).

Functions

Decode base64 encoded data.
Encode the data using base64 encoding.
Catch panics. On error call the callback.
Catches panics and returns the result.
Converts a pointer and lengths to Vec by cloning the contents.
Converts a Vec to (pointer, size, capacity).