2019-11-03 18:00:00 -06:00
|
|
|
// check-pass
|
2015-10-16 20:32:06 -05:00
|
|
|
use std::cell::RefCell;
|
|
|
|
use std::rc::Rc;
|
|
|
|
|
|
|
|
pub struct Callbacks {
|
2019-05-28 13:46:13 -05:00
|
|
|
callbacks: Vec<Rc<RefCell<dyn FnMut(i32)>>>,
|
2015-10-16 20:32:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Callbacks {
|
|
|
|
pub fn register<F: FnMut(i32)+'static>(&mut self, callback: F) {
|
|
|
|
self.callbacks.push(Rc::new(RefCell::new(callback)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|