1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Common `extern "C"` callback type aliases used across the doom-fish family.
//!
//! These callback signatures recur in many crates' Swift / Obj-C bridges.
//! Centralising them here eliminates duplicate definitions and makes
//! cross-crate FFI signatures interchangeable.
use ;
/// Callback that delivers a JSON-encoded payload as a heap-owned C string.
///
/// The receiver is responsible for freeing `json` (typically by passing it back
/// into a Swift bridge `free_*` helper or via the consuming wrapper's Drop impl).
pub type JsonCallback = unsafe extern "C" fn;
/// Callback that fires when a one-shot async operation completes.
///
/// `status` is the operation's exit code (0 = ok, non-zero = error code).
/// `error` is an optional `NSError` JSON payload (may be null on success).
pub type AsyncCallback = unsafe extern "C" fn;
/// Fire-and-forget callback with no payload other than the `user_data` pointer.
pub type SimpleCallback = unsafe extern "C" fn;
/// Drop notification — fires when the Swift side releases the bridged context.
/// Use this to clean up Rust state (typically `Box::from_raw(user_data)`).
pub type DropCallback = unsafe extern "C" fn;
/// Stream-style callback that fires for each event in an ongoing subscription.
///
/// `event_json` is a heap-owned JSON-encoded event payload (caller-owned).
pub type StreamEventCallback = unsafe extern "C" fn;
/// Async callback variant used by avassetwriter / weatherkit / webkit bridges
/// that deliver a (`status`, `result_json`, `error`, `user_data`) tuple.
pub type AsyncCb = unsafe extern "C" fn;