|
|
|
|
|
by pornel
1580 days ago
|
|
`iterator.map(…)` must return a new wrapper type, because it needs to store the closure somewhere, so it returns struct Map { closure, original_iterator }
This fact could have been hidden by making these methods return `impl Iterator`, but it would be strictly less useful/performant in case you needed to store the iterator somewhere, because then you couldn't name the actual type, and would need to work with an abstract one.But I do agree that the way documentation presents traits and their implementations can be overwhelming, especially the Iterator which is a pretty large trait. |
|
I'm sure you know this, but `type Alias = impl Trait;` is on its way which would make naming those possible.