ffi-error-progress-cancellisted
Install: claude install-skill po4yka/rust-skills
# FFI error, progress, and cancellation
## Purpose
Own the end-to-end contract that crosses the FFI boundary for every
long-running operation: a stable error taxonomy, a progress event stream, and
cooperative cancellation. These three concerns are one contract. If you design
them separately, you get an error enum that cannot express "the user pressed
Cancel", a progress stream that leaks a worker thread when the consumer goes
away, and a cancel call that blocks the UI thread.
This skill covers the boundary UX. Related skills cover the parts underneath:
- `uniffi-boundary` - binding generation mechanics and UDL/proc-macro shape.
- `memory-model` - the exact atomic `Ordering` for the cancel flag and the
progress counter.
- `rust-panic-safety` and `rust-discipline` - panic policy at the boundary.
- `rust-debugging` - panic propagation through generated bindings.
- `rust-observability` - the `tracing` subscriber that receives redacted events.
- `rust-jni` - the same three protocols over a hand-written JNI boundary.
## When to use
- You design or review an FFI method that takes measurable time: archive
import, index build, preview generation, large or vector export, batch export,
asset import.
- You map a core error enum to the flat boundary enum, then on to Kotlin
exceptions and Swift `Error`.
- You bridge a Rust progress callback into a Kotlin `Flow` or a Swift
`AsyncThrowingStream`.
- You wire coroutine cancellation or `Task` cancellation down to a Rust job
ca