|
@@ -351,11 +351,18 @@ type ExternalListenerCallback<'bump, T> = BumpBox<'bump, dyn FnMut(T) + 'bump>;
|
|
|
/// }
|
|
|
///
|
|
|
/// ```
|
|
|
-#[derive(Default)]
|
|
|
pub struct EventHandler<'bump, T = ()> {
|
|
|
pub callback: RefCell<Option<ExternalListenerCallback<'bump, T>>>,
|
|
|
}
|
|
|
|
|
|
+impl<'a> Default for EventHandler<'a> {
|
|
|
+ fn default() -> Self {
|
|
|
+ Self {
|
|
|
+ callback: RefCell::new(None),
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
impl<T> EventHandler<'_, T> {
|
|
|
/// Call this event handler with the appropriate event type
|
|
|
pub fn call(&self, event: T) {
|