Expand description
§callback — Named callback registry
Provides a thread-safe, global registry of named callbacks.
Callbacks can be registered either from Rust (typed closure) or from
the C/Go side via ffi_register_callback (C function pointer).
§Design
The registry is a Mutex<HashMap<String, CallbackFn>> initialized lazily
via once_cell. All exported functions are panic-safe via catch_panic.
§Thread safety
The registry is protected by a std::sync::Mutex. If a thread panics while
holding the lock, the lock becomes poisoned and all subsequent operations
return FfiError::LockPoisoned.
Functions§
- callback_
count - Return the number of currently registered callbacks.
- ffi_
callback_ count - Return the number of registered callbacks.
- ffi_
invoke_ ⚠callback - Invoke a registered callback by name.
- ffi_
register_ ⚠callback - Register a C function pointer as a named callback.
- ffi_
unregister_ ⚠callback - Remove a registered callback by name.
- register_
callback - Register a named callback from Rust code.
- unregister_
callback - Remove a callback by name from Rust code.