You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was bit surprised by that Itertools::tuple_windows is not somewhat lazy and has side effect.
It is consuming the first tuple when calling Itertools::tuple_windows .
I looked for (mut text in function definitions and found multiple functions I thought as lazy to actually consume one item before we actually consume them:
tuple_windows relying on the struct TupleWindows as mentioned before ;
CoalesceBy and Product also uses #[must_use = "iterator adaptors are lazy and do nothing unless consumed"].
Now that I think about it, I suppose we could argue that "must_use" implies that the user is supposed to consume the iterator and consume one item at definition is not a big deal since it's "just a moment" before the rest?!
I was bit surprised by that
Itertools::tuple_windows
is not somewhat lazy and has side effect.It is consuming the first tuple when calling
Itertools::tuple_windows
.https://doc.rust-lang.org/nightly/core/iter/index.html#laziness says that adapters in
Iterator
is lazy andthe
TupleWindows
has#[must_use = "iterator adaptors are lazy and do nothing unless consumed]
since #227So the question is
Itertools
be lazy?The text was updated successfully, but these errors were encountered: