blob: 3339af364a0058b95e5c8abfc24478c5041fa2c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// check-pass
use std::cell::RefCell;
use std::rc::Rc;
pub struct Callbacks {
callbacks: Vec<Rc<RefCell<dyn 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() {}
|