docs: add comments for the Handler

This commit is contained in:
Jonathan Kelley 2022-01-16 15:13:31 -05:00
parent e47ead5347
commit 036a0ff49a

View file

@ -357,12 +357,14 @@ pub struct EventHandler<'bump, T = ()> {
}
impl<T> EventHandler<'_, T> {
/// Call this event handler with the appropriate event type
pub fn call(&self, event: T) {
if let Some(callback) = self.callback.borrow_mut().as_mut() {
callback(event);
}
}
/// Forcibly drop the internal handler callback, releasing memory
pub fn release(&self) {
self.callback.replace(None);
}