fix: explicit default for event handler

rust derives default of T: Default, even when that's not a necessary requirement

This fixes that
This commit is contained in:
Jonathan Kelley committed 2022-01-29 10:27:40 -05:00
1 parent 06723ad63f
commit 8056138f86
1 file changed
+8 -1
+8 -1
View File
@@ -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) {