Crate ffi_utils[][src]

FFI utilities

Re-exports

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

Modules

bindgen_utils

Utilities for binding generators.

callback

Helpers to work with extern "C" callbacks.

java

Java/JNI utilities.

string

Utilities for passing strings across FFI boundaries.

test_utils

Test utilities.

Macros

call_result_cb
ffi_error

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

ffi_error_code
ffi_result

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

ffi_result_code
gen_byte_array_converter
gen_ctx

Generates a user_data context containing a reference to a single or several Java callbacks

gen_object_array_converter
gen_primitive_type_converter

Generates primitive type converters

jni_unwrap

Unwraps the results and checks for Java exceptions. Required for exceptions pass-through (simplifies debugging).

try_cb

Structs

FfiResult

FFI result wrapper

OpaqueCtx

Type that holds opaque user data handed into FFI functions

Constants

FFI_RESULT_OK

Constant value to be used for OK result

Traits

ErrorCode

Trait for types that can be converted to integer error code.

ReprC

Trait to convert between FFI and Rust representations of types

SafePtr

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

base64_decode

Decode base64 encoded data.

base64_encode

Encode the data using base64 encoding.

catch_unwind_cb

Catch panics. On error call the callback.

vec_clone_from_raw_parts

Converts a pointer and lengts to Vec by cloning the contents.

vec_into_raw_parts

Converts a Vec to (pointer, size, capacity)