Impl trait in argument types
When you use an impl Trait
in the type of a function argument, that is generally equivalent to adding a generic parameter to the function.
So this function:
is roughly equivalent to the following generic function:
Intuitively, a function that has an argument of type impl Iterator
is saying "you can give me any sort of iterator that you like".