I was wondering why
Iterator::map takes a closure that has a value as argument instead of a reference, then I gave a look into the code and I found out that it’s because
Option::map (that is used internally) takes
self instead of
Anyway I cannot understand the reason of this choice. Why we want to move the value when we use
Generally speaking there is some guideline/good practice to decide when is better to prefer passing by reference or value?