|
|
|
|
|
by aturon
4137 days ago
|
|
> The way variables are captured from the environment into the closure is controlled by the "move" keyword. If the "move" keyword precedes a closure expression, then variables from the environment are moved into the closure, which takes ownership of them. Note: if you don't specify `move`, then the captures are determined in the usual way: `|| v.len()` captures `v` via an immutable borrow `|| v.push(0)` captures `v` via a mutable borrow `|| v.into_iter()` captures `v` by moving it |
|