-// Rust-101, Part 11: Trait Objects, Box, Rc
-// =========================================
+// Rust-101, Part 11: Trait Objects, Box, Rc, Lifetime bounds
+// ==========================================================
mod callbacks {
// For now, we just decide that the callbacks have an argument of type `i32`.
c.call(0);
let mut count: usize = 0;
- c.register(Box::new(move |val| { count = count+1; println!("Callback 2, {}. time: {}", count, val); } ));
+ c.register(Box::new(move |val| {
+ count = count+1;
+ println!("Callback 2, {}. time: {}", count, val);
+ } ));
c.call(1); c.call(2);
}
}