Commented out final 'main' function in order to fit within pattern of other examples and prevent incorrect indentation
This commit is contained in:
parent
4497196ba5
commit
32fb2527d9
1 changed files with 4 additions and 2 deletions
|
|
@ -510,6 +510,7 @@ fn factory() -> Box<Fn(i32) -> i32> {
|
|||
|
||||
Box::new(|x| x + num)
|
||||
}
|
||||
|
||||
# fn main() {
|
||||
let f = factory();
|
||||
|
||||
|
|
@ -540,12 +541,13 @@ fn factory() -> Box<Fn(i32) -> i32> {
|
|||
|
||||
Box::new(move |x| x + num)
|
||||
}
|
||||
fn main() {
|
||||
|
||||
# fn main() {
|
||||
let f = factory();
|
||||
|
||||
let answer = f(1);
|
||||
assert_eq!(6, answer);
|
||||
}
|
||||
# }
|
||||
```
|
||||
|
||||
By making the inner closure a `move Fn`, we create a new stack frame for our
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue