pub type UnitCompletion = SyncCompletion<()>;Expand description
Unit completion - for operations that return success/error without a value
Aliased Type§
pub struct UnitCompletion { /* private fields */ }Implementations§
Source§impl UnitCompletion
impl UnitCompletion
Sourcepub unsafe extern "C" fn callback(
context: *mut c_void,
success: bool,
msg: *const c_char,
)
pub unsafe extern "C" fn callback( context: *mut c_void, success: bool, msg: *const c_char, )
C callback for operations that return (context, success, error_msg)
This can be used directly wherever a
crate::ffi_callbacks::UnitCompletionCallback is required.
The body is wrapped in catch_user_panic so that a mutex-poison
panic (or any other unexpected panic) does not unwind across the
extern "C" boundary, which would be undefined behaviour.
§Safety
context must be the exact live pointer returned with this
UnitCompletion, must be invoked exactly once, and must not be used
after this call. The internal atomic flag does not protect storage
that has already been freed or concurrently invalidated.
When success is false, msg must be null or point to a valid
NUL-terminated C string for the duration of this call. It is ignored
when success is true.