projects
/
rust-101.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
finish part 14
[rust-101.git]
/
workspace
/
src
/
part11.rs
diff --git
a/workspace/src/part11.rs
b/workspace/src/part11.rs
index 01f170b40ce7b34d41a2c39c11e6d32ca40e6f07..cc2a2524dcc0233c77cbb1ac7e0cd6899223d807 100644
(file)
--- a/
workspace/src/part11.rs
+++ b/
workspace/src/part11.rs
@@
-1,5
+1,5
@@
-// 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`.
mod callbacks {
// For now, we just decide that the callbacks have an argument of type `i32`.
@@
-41,7
+41,10
@@
mod callbacks {
c.call(0);
let mut count: usize = 0;
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);
}
}
c.call(1); c.call(2);
}
}