doom-fish-utils 0.1.1

Framework-agnostic FFI utilities shared by the doom-fish Apple-SDK Rust bindings: async/sync completion handlers, FFI string helpers, FourCharCode, panic-safe extern-C wrappers, and executor-agnostic bounded async streams.
Documentation
  • Coverage
  • 100%
    53 out of 53 items documented6 out of 45 items with examples
  • Size
  • Source code size: 66.02 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.84 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • doom-fish/doom-fish-utils
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 1313

doom-fish-utils

Framework-agnostic FFI utilities shared by every safe-Rust Apple-SDK binding in the doom-fish family.

What's in here

Module Purpose
completion Sync + async completion handlers for callback-based FFI APIs. Provides AsyncCompletion<T> and SyncCompletion<T> with AtomicBool double-fire guards.
ffi_string Helpers for retrieving owned Strings from buffer-writing or pointer-returning C / Swift APIs, with RAII-driven dealloc.
four_char_code FourCharCode newtype (used by pixel formats, OSType codes, AudioToolbox, VideoToolbox, etc.).
panic_safe catch_user_panic(...) wrapper for extern "C" callbacks so a Rust panic doesn't unwind into Swift / C code.
stream BoundedAsyncStream<T> — executor-agnostic, bounded, lossy-by-default async stream lifted from the screencapturekit-rs AsyncSCStream pattern. Generic over any item type.

Design tenets

  • Executor-agnostic. No tokio / async-std / smol dependencies; works anywhere std::future::Future works.
  • Defence in depth. The async completion path uses an AtomicBool consumed flag to prevent double-fire UAF in the face of misbehaving Swift callbacks.
  • Panic-safe. extern "C" callbacks pass through panic_safe wrappers so an unexpected Rust panic logs and returns rather than unwinding into Swift / C code.

Optional features

  • futures-stream — adds a futures_core::Stream impl on BoundedAsyncStream<T> so the stream can be used directly with futures::StreamExt / tokio_stream.

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.

License

Dual-licensed under MIT OR Apache-2.0.