mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 19:20:43 +01:00
docs: add docs to callback helper functions
This commit is contained in:
@@ -524,6 +524,7 @@ impl Drop for Notification {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This function translates c callback to rust. Used in `add_action`
|
||||||
unsafe extern "C" fn action_trampoline<F>(
|
unsafe extern "C" fn action_trampoline<F>(
|
||||||
_notification: *mut NotifyNotification,
|
_notification: *mut NotifyNotification,
|
||||||
action: *mut ::std::os::raw::c_char,
|
action: *mut ::std::os::raw::c_char,
|
||||||
@@ -541,6 +542,7 @@ unsafe extern "C" fn action_trampoline<F>(
|
|||||||
callback(&action);
|
callback(&action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This function tells c how to free memory of our callback
|
||||||
unsafe extern "C" fn drop_box<F>(data: gpointer) {
|
unsafe extern "C" fn drop_box<F>(data: gpointer) {
|
||||||
unsafe { drop(Box::from_raw(data as *mut F)) };
|
unsafe { drop(Box::from_raw(data as *mut F)) };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user