Expand description
Synchronous completion utilities for async FFI callbacks
This module provides a generic mechanism for blocking on async Swift FFI callbacks and propagating results (success or error) back to Rust synchronously.
§Example
ⓘ
use screencapturekit::utils::sync_completion::{SyncCompletion, SyncCompletionPtr};
// Create completion for a String result
let (completion, context) = SyncCompletion::<String>::new();
// Pass context to FFI, which will call back with result
unsafe { some_ffi_call(context, callback) };
// Block until callback completes
let result = completion.wait();Structs§
- Async
Completion - An async completion handler for FFI callbacks
- Async
Completion Future - Future returned by
AsyncCompletion - Sync
Completion - A synchronous completion handler for async FFI callbacks
Functions§
- error_
from_ ⚠cstr - Helper to extract error message from a C string pointer
Type Aliases§
- Sync
Completion Ptr - Raw pointer type for passing to FFI callbacks
- Unit
Completion - Unit completion - for operations that return success/error without a value