1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use std::rc::Rc; pub trait Notifiable { fn notify(&self); } pub trait Notifies { fn set_notify(&self, callback: Rc<Notifiable>); } impl<T> Notifiable for T where T: Fn() -> (), { fn notify(&self) { self(); } }