pub unsafe fn ffi_string_owned<F>(ffi_call: F) -> Option<String>Expand description
Retrieves a string from an FFI function that returns an owned C string pointer.
This is more efficient than buffer-based retrieval as it avoids pre-allocation.
The FFI function allocates the string (via strdup) and this function takes
ownership and frees it.
§Arguments
ffi_call- A closure that returns an owned C string pointer (or null)
§Returns
Some(String)if the pointer was non-null and valid UTF-8Noneif the pointer was null
§Safety
The caller must ensure the returned pointer was allocated by Swift’s strdup
or equivalent, and that sc_free_string properly frees it.