Closures capture their environment by reference, mutable reference or value, inferring the least restrictive of Fn, FnMut and FnOnce. `move` forces capture by value, which is required when spawning threads or returning closures from functions.
← Rust theorytheory 0/50 · 0%
Abstraction · medium
26. Closures
Fn, FnMut and FnOnce.
Check your understanding
1. Which trait consumes captured values?
2. What does `move` do?