use std::{rc::Rc, cell::RefCell}; #[derive(Debug)] struct SignalerInner { closures: RefCell>> } impl SignalerInner { fn new() -> SignalerInner { SignalerInner { closures: RefCell::new(Vec::new()) } } } #[derive(Debug)] pub struct Signaler { inner: Rc> } impl Clone for Signaler { fn clone(&self) -> Signaler { Signaler { inner: self.inner.clone() } } } impl Signaler { pub fn new() -> Signaler { Signaler { inner: Rc::new(SignalerInner::new()) } } fn register_closure(&self, f: F) { } fn send_event(&self, event: &mut E) { } }