I\'m trying to sort an array with a map() over an iterator.
struct A {
b: Vec,
}
#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct
I use for_each. According to the doc:
It is equivalent to using a
forloop on the iterator, althoughbreakandcontinueare not possible from a closure. It's generally more idiomatic to use aforloop, butfor_eachmay be more legible when processing items at the end of longer iterator chains. In some casesfor_eachmay also be faster than a loop, because it will use internal iteration on adaptors likeChain.