docs: add comments for the Handler
This commit is contained in:
1 parent
e47ead5347
commit
036a0ff49a
1 file changed
+2
@@ -357,12 +357,14 @@ pub struct EventHandler<'bump, T = ()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> EventHandler<'_, T> {
|
impl<T> EventHandler<'_, T> {
|
||||||
|
/// Call this event handler with the appropriate event type
|
||||||
pub fn call(&self, event: T) {
|
pub fn call(&self, event: T) {
|
||||||
if let Some(callback) = self.callback.borrow_mut().as_mut() {
|
if let Some(callback) = self.callback.borrow_mut().as_mut() {
|
||||||
callback(event);
|
callback(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Forcibly drop the internal handler callback, releasing memory
|
||||||
pub fn release(&self) {
|
pub fn release(&self) {
|
||||||
self.callback.replace(None);
|
self.callback.replace(None);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user