11}
12
13▶fn main() {
14 let fancy_num = FancyNum { num: 5 };
15 let fancy_ref = &fancy_num;
· · ·
16
17 let x = move || {
18▶ println!("child function: {}", fancy_num.num);
19 // error: cannot move `fancy_num` into closure because it is borrowed
20 };
· · ·
21
22 x();
23▶ println!("main function: {}", fancy_ref.num);
24}
25```
· · ·
37}
38
39▶fn main() {
40 let fancy_num = FancyNum { num: 5 };
41 let fancy_ref = &fancy_num;
· · ·
43 let x = move || {
44 // fancy_ref is usable here because it doesn't move `fancy_num`
45▶ println!("child function: {}", fancy_ref.num);
46 };
47
+ 6 more matches in this file