2018-09-30 07:27:26 -05:00
|
|
|
// compile-pass
|
2015-10-16 20:32:06 -05:00
|
|
|
use std::cell::RefCell;
|
|
|
|
use std::rc::Rc;
|
|
|
|
|
|
|
|
pub struct Callbacks {
|
|
|
|
callbacks: Vec<Rc<RefCell<FnMut(i32)>>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Callbacks {
|
|
|
|
pub fn register<F: FnMut(i32)+'static>(&mut self, callback: F) {
|
|
|
|
self.callbacks.push(Rc::new(RefCell::new(callback)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|