Expand description
§ffi-bridge
Memory-safe Go↔Rust FFI boundary helpers.
This crate provides:
FfiBuffer— heap-allocated byte buffer with explicit ownership semanticsFfiString— UTF-8 string safe for crossing the FFI boundaryFfiResult— C-ABI result type conveying either a payload or an errorFfiError/FfiErrorCode— rich error taxonomy matching the C header- Callback registry — register and invoke named callbacks across the FFI boundary
catch_panic— converts Rust panics toFfiResultso they never cross the ABI
§Safety contract
- All buffers and strings allocated by this crate must be freed by the
corresponding
ffi_*_freefunction exported from this crate. - Panics are caught at every
extern "C"boundary viacatch_panic. - No Rust type with a
Dropimpl is allowed to cross the FFI boundary as a value; onlyrepr(C)POD structs may do so.
Re-exports§
pub use callback::callback_count;pub use callback::ffi_callback_count;pub use callback::ffi_invoke_callback;pub use callback::ffi_register_callback;pub use callback::ffi_unregister_callback;pub use callback::register_callback;pub use callback::unregister_callback;pub use errors::catch_panic;pub use errors::ffi_result_free;pub use errors::FfiError;pub use errors::FfiErrorCode;pub use errors::FfiResult;pub use memory::ffi_buffer_alloc;pub use memory::ffi_buffer_free;pub use memory::ffi_string_alloc;pub use memory::ffi_string_free;pub use memory::FfiBuffer;pub use memory::FfiString;pub use bridge::*;pub use types::*;