itertools
itertools copied to clipboard
Brainstorm for what goes in std inclusion
What parts of Itertools are solid enough for std?
.join(sep: &str) -> String
where Self::Item: Display
- Pro Very popular, easy to use
- Con Using
Displayis very "do what I mean" (which is mostly good) but not a zero cost abstraction; formatting uses dynamic dispatch
Plan: ?
.collect_vec() -> Vec<_>
- Pro Popular, often what you want
- Con Std prefers generic over specific. Name is bad
Plan: Propose under name .into_vec() for iterators.
.format(sep: &str)
- Pro Unique, does something smart neatly that otherwise requires some boring trait impl code
- Con Bends how format strings are used (once per element instead of just once)
- Con Is only once formattable (due to being once-iterable).
Plan: Propose as is?
.flatten()
- Pro simple, no closure in the type
- Pro skip double-endedness on introduction, simplifying all kinds of special implementations for the iterator
No-gos
I think join is not a good idea, join should work with PathBuf as well and use Separator like the one in slice::join. https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/join.20on.20Iterator
flatten seemed to be there in std already.