Add Iterator::intersperse_with by lukaslueg · Pull Request #80567 · rust-lang/rust (original) (raw)
This is a follow-up to #79479, tracking in #79524, as discussed #79479 (comment).
Note that I had to manually implement Clone and Debug because derive insists on placing a Clone-bound on the struct-definition, which is too narrow. There is a long-standing issue # for this somewhere around here :-)
Also, note that I refactored the guts of Intersperse into private functions and re-used them in IntersperseWith, so I also went light on duplicating all the tests.
If this is suitable to be merged, the tracking issue should be updated, since it only mentions intersperse.
Happy New Year!
r? @m-ou-se