projects
/
rust-101.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
663d6d7
)
Fix usize typo
author
Nelson Chen
<crazysim@gmail.com>
Sat, 5 Sep 2015 11:29:16 +0000
(
04:29
-0700)
committer
Nelson Chen
<crazysim@gmail.com>
Sat, 5 Sep 2015 11:29:16 +0000
(
04:29
-0700)
src/part11.rs
patch
|
blob
|
history
diff --git
a/src/part11.rs
b/src/part11.rs
index 7361604aa8ea0732be7a61353ba037c93b9fd2d2..9217be831b713c3837b2416fd0300499db53f16c 100644
(file)
--- a/
src/part11.rs
+++ b/
src/part11.rs
@@
-87,7
+87,7
@@
pub fn main() {
//@ that doesn't work out this time. Remember the `'static` bound above? Borrowing `count` in the environment would
//@ violate that bound, as the borrow is only valid for this block. If the callbacks are triggered later, we'd be in trouble.
//@ We have to explicitly tell Rust to `move` ownership of the variable into the closure. Its environment will then contain a
//@ that doesn't work out this time. Remember the `'static` bound above? Borrowing `count` in the environment would
//@ violate that bound, as the borrow is only valid for this block. If the callbacks are triggered later, we'd be in trouble.
//@ We have to explicitly tell Rust to `move` ownership of the variable into the closure. Its environment will then contain a
- //@ `usize` rather than a `&mut us
zi
e`, and the closure has no effect on this local variable anymore.
+ //@ `usize` rather than a `&mut us
iz
e`, and the closure has no effect on this local variable anymore.
let mut count: usize = 0;
c.register_generic(move |val| {
count = count+1;
let mut count: usize = 0;
c.register_generic(move |val| {
count = count+1;