Warning
This post was published 48 days ago. The information described in this article may have changed.
I'm learning closures, and it is stated that FnMut
parameter must be declared mut
. One example I find is the fold
method of iterator. But when I look up the documentation, the closure parameter doesn't have mut
(Iterator in std::iter - Rust) while the linked source code has mut
(iterator.rs - source), and I notice the same thing for the self
parameter. I'm a bit confused. Is it a bug in documentation or is it a convention to elide some finer details? As rust is new to me, I would prefer the documentation being more precise.
4 posts - 3 participants
🏷️ rust_feed