3 ms·
Fn: a function that can be called many times without side effects. Can be shared. Almost exactly like regular functions besides the capturing. FnMut: a functio
by conradludgate 4y ago
Fn: a function that can be called many times without side effects. Can be shared. Almost exactly like regular functions besides the capturing.
FnMut: a function that can be called many times but can have side effects, because of this it must be exclusively held (&mut F)
FnOnce: a function that can be called only once, making use of by-ownership function calls
So I remember it like
Fn: just a function
FnMut: a function that needs &mut access
FnOnce: only used once, moving ownership