itertools
itertools copied to clipboard
Extra iterator adaptors, iterator methods, free functions, and macros.
[Running this playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=724625d75ea8a7d8366c4dfed0ab24f6), it looks like you can't `peek_nth` with an argument of `usize::MAX` without panicking. In a way, this makes sense cause `peek_nth` gets you an item with index...
If I write this code using `k_smallest`, and ask for `usize::MAX` items, this returns all the items in the iterator, which makes sense. ```rust use itertools::Itertools; #[test] fn k_smallest_memory_is_fine() {...
Reading the docs for `pad_using`: > Return an iterator adaptor that pads the sequence to a minimum length of min by filling missing elements using a closure f. And the...
Current [PeekingNext](https://docs.rs/itertools/latest/itertools/trait.PeekingNext.html) trait is only implemented for std iterators that can be copied easily. This is done using the [`peeking_next_by_clone!`](https://docs.rs/itertools/latest/src/itertools/peeking_take_while.rs.html#165-201) macro in the implementation, and affects: - `::std::slice::Iter` for Vec/Slices/arrays...
Hi, I had a reason that I wanted to `Clone` a `Chunk` iterator from the `chunks(...)` adapter. I can't see a reason that this impl would be bad, so I...
# Summary Why the iterator combinators in this crate (and elsewhere) return concrete public types like `Interleave` instead of opaque `impl Trait`s? # Musing I've been using `itertools` for a...
This means you sometimes can't use `Result::expect` on the result of `exactly_one`. ```rust use itertools::Itertools; fn foo(cows: impl Iterator) -> i32 { cows.exactly_one().expect("there should only be one cow") } ```...
Add an optional `hashbrown` feature that switches the underlying hash map implementation from `std::collections` to `hashbrown` and makes items that depend on hash maps available without `use_std` (although it still...
Follow-up to #1046 I'm pondering whether ``` fn exactly_one(mut self) -> Result ``` should rather be ``` fn exactly_one(&mut self) -> Result ``` and `ExactlyOneError` should contain an `Option`, so...