feat: fake bubbling

This commit is contained in:
Jonathan Kelley committed 2021-11-11 22:18:16 -05:00
1 parent f2234068ba
commit 11757ddf61
4 files changed
+21 -19

No files matched your search

+2 -2
View File
@@ -24,7 +24,7 @@ pub mod on {
c: NodeFactory<'a>,
mut callback: F,
) -> Listener<'a>
where F: FnMut(&$wrapper) + 'a
where F: FnMut(Arc<$wrapper>) + 'a
{
let bump = &c.bump();
@@ -32,7 +32,7 @@ pub mod on {
// safety: this is essentially the same as calling Box::new() but manually
// The box is attached to the lifetime of the bumpalo allocator
let cb: &mut dyn FnMut(Arc<dyn Any + Send + Sync>) = bump.alloc(move |evt: Arc<dyn Any + Send + Sync>| {
let event = evt.downcast_ref::<$wrapper>().unwrap();
let event = evt.downcast::<$wrapper>().unwrap();
callback(event)
});