Hacker News new | ask | show | jobs
by GolDDranks 2957 days ago
This is hard to answer as a one-liner; do you know about monomorphic vs. polymorphic code and static/dynamic dispatching? Rust is, by default statically dispatched, so because the two kinds of iterators do different things, they have to be of different types.
1 comments

Ah, that makes sense, thank you.

One iterator simply returns the value and increments, and the other needs to apply the filter first and potentially advance several times.