Skip to main content

Crate doom_fish_utils

Crate doom_fish_utils 

Source
Expand description

§doom-fish-utils

Framework-agnostic FFI utilities shared by the doom-fish family of safe Rust bindings to Apple SDKs.

§Modules

ModulePurpose
completionSync and async completion handlers for FFI callbacks
ffi_callbacksCommon unsafe extern "C" callback type aliases shared across bridge crates
ffi_stringOwned-string helpers around heap-allocated C strings
four_char_codeFourCharCode wrapper (used by pixel formats, OSType codes, etc.)
panic_safeContains supported callback and panic-payload failures, with explicit cleanup before best-effort destruction
spscLock-free single-producer single-consumer rings for real-time callback → async-consumer handoff
streamExecutor-agnostic bounded async streams (waker + VecDeque + lossy oldest-drop policy)

§Design tenets

  • Executor-agnostic. No tokio / async-std / smol dependencies; works anywhere std::future::Future works.
  • Defence in depth. Completion contexts are exact-live and one-shot. Their atomic consumed flags only reject duplicates while the backing allocation remains live; they do not validate dangling raw pointers.
  • Panic-safe. extern "C" callbacks pass through panic_safe wrappers. Explicit cleanup runs before opaque destruction; multiple destructor panics within one aggregate remain outside the contract.

§Stability

This crate is the foundation of every doom-fish Apple-SDK binding crate. Breaking changes ship as major version bumps; minor versions add modules or non-breaking helpers.

Re-exports§

pub use four_char_code::FourCharCode;

Modules§

completion
Synchronous completion utilities for async FFI callbacks
ffi_callbacks
Common extern "C" callback type aliases used across the doom-fish family.
ffi_string
FFI string utilities
four_char_code
Minimal FourCharCode implementation for pixel formats and color conversions
panic_safe
Panic-safety helpers for the C ABI boundary.
spsc
Single-producer single-consumer lock-free bounded ring buffer.
stream
Executor-agnostic bounded async streams for FFI callbacks.