this post was submitted on 10 Apr 2024
32 points (100.0% liked)
Rust
5974 readers
134 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The composability doesn't have much to do with whether it's a reference or a move, it's because it bypasses usage of the
Iterator
methods. Iterators chains can consist offilter
,map
and other operations, which allows various functions and/or closures to be composed together. Whereas withretain_mut()
there isn't really a chain and functions you may otherwise use in an iterator chain become harder to (re)use.