Up to this moment I thought that move |...| {...}
would move variables inside a closure and the closure would implement only FnOnce
, because you can mo
Up to this moment I thought that
move |...| {...}
will move variables inside closure and closure will implement onlyFnOnce
, because you can move vars only once.
The variables are moved when the closure is created, not when it is invoked. Since you're only creating one closure, the move only happens once - regardless of how often map
calls the function.