ffi-and-language-interop
SolidFFI and native interop rules: single documented pointer ownership, opaque handles, null-pointer checks, allocate/free pairs, unsafe-block invariants, generated C headers, stable C ABI, frozen struct layouts, and error/context conversion. Load when writing or reviewing FFI boundaries between native and host languages.
Install
Quality Score: 84/100
Skill Content
Details
- Author
- Goldziher
- Repository
- Goldziher/ai-rulez
- Created
- 1 years ago
- Last Updated
- today
- Language
- Go
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
rust-ffi
Design an FFI boundary meant to last — a thin translation layer with the logic in core crates, no panic across the boundary, explicit ownership on every pointer, repr(transparent) newtypes, and unsafe extern in edition 2024. Use when designing or reviewing a Rust FFI surface, when exposing a Rust library to another language, when a DLL or shared library keeps state, or when the user asks how to shape an extern function.
uniffi-boundary
Use when you author, change, or review a UniFFI cross-language boundary crate that generates Kotlin and Swift bindings from Rust. Covers proc-macro-first scaffolding versus UDL, the Record/Object/Enum/Error derives, the Record-versus-Object decision, Send + Sync requirements on exported interfaces, Arc-based ownership and object identity across the boundary, callback interfaces and foreign traits, custom types and newtype converters, versioned payloads that cross as JSON strings, coarse-boundary and large-data rules, built-in type mapping to Kotlin and Swift, async export rules, codegen failure triage, and a review checklist. Triggers on uniffi, uniffi::export, uniffi::constructor, derive Record/Object/Enum/Error, setup_scaffolding, uniffi-bindgen, UDL, callback_interface, with_foreign, custom_newtype, foreign trait, or any question about what may cross an FFI boundary.
ffi-error-progress-cancel
Use when you design or review an FFI boundary for a long-running Rust operation that must report typed errors, stream progress, and cancel cooperatively - import, indexing, preview, render, export, or any job longer than one frame. Covers a closed versioned boundary error taxonomy, UniFFI flat error enums, mapping stable error codes to native UX buckets, redaction so no backtrace or filesystem path crosses the boundary, callback-interface progress listeners carrying job id plus stage and fraction, bridges to Kotlin Flow with callbackFlow and awaitClose and to Swift AsyncThrowingStream with onTermination, and wiring coroutine cancel and Task cancel down to an idempotent non-blocking cancel_job. Triggers on flat_error, callback interface, callbackFlow, awaitClose, trySend, AsyncThrowingStream, CancellationException, CancellationError, cancel_job, job_id, progress event, or "the UI must not show stack traces".