mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
15 lines
302 B
Rust
15 lines
302 B
Rust
//@ 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() {}
|