I'm a rust newbe trying to use flat_map on an iterator and i'm a bit lost on the error message here.
Could someone help me understand what i'm doing wrong?
I simplified to the maximum, but the point of "mux" would be to filter/split S into 0 or more instances of S. Applying this, i want to create a new iterator of S from an original iterator of S.
Thanks for the quick reply Alice
Returning Vec<&S> was indeed a mistake.
But what I'm really trying to do is to have a bunch of "mux" functions and generate several different iterators from the initial one, hence my trying to not consume S but pass it as reference (read only).
Or does it mean i must first clone the iterator before applying a transformation?