itertools icon indicating copy to clipboard operation
itertools copied to clipboard

Extra iterator adaptors, iterator methods, free functions, and macros.

Results 211 itertools issues
Sort by recently updated
recently updated
newest added

This is similar to `partition_result`. The idea is that instead of a collection of `Ok` values and a collection of `Err` values, it would return a single `Result`. This is...

Similar to `exactly_one_error`'s error type, `all_equal_value`'s error type now implements `std::error::Error`. (I saw the discrepancy because [`exactly_one_error` works with `anyhow`, whereas `all_equal_value` does not](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=1a7b1ab8181cc5345ecc2461709b8cf6).) Since I had to introduce a...

breaking-change

This is expected to panic on length mismatch

Hello itertools users and maintainers! The Rust library team has recently discussed the possibility of upstreaming some of the more commonly used itertools methods to the standard library. We now...

It would be interesting to add a `next_arrayvec` iterator method. It should construct an ArrayVec with capacity `N`, filling it from the next elements of an iterator. If not enough...

Some logging frameworks will format things sent to the `error!` macro twice. Some possible solutions: 1. Print a "iterator exhausted" message instead of panicking 2. Impose a `Clone` bound on...

Rust 1.85 implements `FromIterator` for `(A_1, ..., A_n)` when each `A_i` is `Default + Extend` (and `n` is at most 12) so `iter.multiunzip()` can be replaced by `iter.collect()`.

Hello! [std has chunk_by](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.chunk_by) and [so does itertools](https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.chunk_by) It seems to me, that the only difference is that std does not return the value of the functor, But I'm not...

What would be equivalent of this? ```rust fn merge_sum( map1: HashMap, map2: HashMap, ) -> HashMap { let mut merged = map1; for (key, value) in map2 { *merged.entry(key).or_insert(0) +=...

Now that `next_array` exists, it's not so hard to write the methods `array_chunks` (functionally equivalent to `from_fn(|| self.next_array())`) and `array_windows`, similar to the unstable [`slice::array_chunks`](https://github.com/rust-lang/rust/issues/74985) and [`slice::array_windows`](https://github.com/rust-lang/rust/issues/75027) respectively. However it's...