pub struct Callbacks {
pub allocate: Option<fn(&Change)>,
pub free: Option<fn(&Change)>,
pub resize: Option<fn(&Change)>,
}Expand description
Handlers to install with set_callbacks, one per ChangeKind.
Plain fn pointers rather than closures on purpose: the C side keeps the
registration until it is replaced, so anything captured would have to outlive the
process. Route per-instance state through a static (an atomic counter, a channel
sender in a OnceLock) instead.
Fields§
§allocate: Option<fn(&Change)>Called after each successful allocation.
free: Option<fn(&Change)>Called after each successful free.
resize: Option<fn(&Change)>Called after each successful realloc.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Callbacks
impl RefUnwindSafe for Callbacks
impl Send for Callbacks
impl Sync for Callbacks
impl Unpin for Callbacks
impl UnsafeUnpin for Callbacks
impl UnwindSafe for Callbacks
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more