fix subscriptions in events

This commit is contained in:
Evan Almloff committed 2023-08-04 17:23:57 -07:00
1 parent 07ed3e67dd
commit a6f611eccf
12 files changed
+445 -103

No files matched your search

+5 -1
View File
@@ -1,7 +1,9 @@
use std::{
cell::{Cell, RefCell},
rc::Rc,
};
use crate::ScopeId;
/// A wrapper around some generic data that handles the event's state
///
@@ -134,13 +136,15 @@ impl<T: std::fmt::Debug> std::fmt::Debug for Event<T> {
/// }
///
/// ```
pub struct EventHandler<'bump, T = ()> {
pub struct EventHandler<'bump, T:?Sized = ()> {
pub(crate) origin: ScopeId,
pub(super) callback: RefCell<Option<ExternalListenerCallback<'bump, T>>>,
}
impl<T> Default for EventHandler<'_, T> {
fn default() -> Self {
Self {
origin: ScopeId(0),
callback: Default::default(),
}
}