1# Changelog 2 3## 0.10.4 4 - Add `EitherOrBoth::or` and `EitherOrBoth::or_else` (#593) 5 - Add `min_set`, `max_set` et al. (#613, #323) 6 - Use `either/use_std` (#628) 7 - Documentation fixes (#612, #625, #632, #633, #634, #638) 8 - Code maintenance (#623, #624, #627, #630) 9 10## 0.10.2 11 - Add `Itertools::multiunzip` (#362, #565) 12 - Add `intersperse` and `intersperse_with` free functions (#555) 13 - Add `Itertools::sorted_by_cached_key` (#424, #575) 14 - Specialize `ProcessResults::fold` (#563) 15 - Fix subtraction overflow in `DuplicatesBy::size_hint` (#552) 16 - Fix specialization tests (#574) 17 - More `Debug` impls (#573) 18 - Deprecate `fold1` (use `reduce` instead) (#580) 19 - Documentation fixes (`HomogenousTuple`, `into_group_map`, `into_group_map_by`, `MultiPeek::peek`) (#543 et al.) 20 21## 0.10.1 22 - Add `Itertools::contains` (#514) 23 - Add `Itertools::counts_by` (#515) 24 - Add `Itertools::partition_result` (#511) 25 - Add `Itertools::all_unique` (#241) 26 - Add `Itertools::duplicates` and `Itertools::duplicates_by` (#502) 27 - Add `chain!` (#525) 28 - Add `Itertools::at_most_one` (#523) 29 - Add `Itertools::flatten_ok` (#527) 30 - Add `EitherOrBoth::or_default` (#583) 31 - Add `Itertools::find_or_last` and `Itertools::find_or_first` (#535) 32 - Implement `FusedIterator` for `FilterOk`, `FilterMapOk`, `InterleaveShortest`, `KMergeBy`, `MergeBy`, `PadUsing`, `Positions`, `Product` , `RcIter`, `TupleWindows`, `Unique`, `UniqueBy`, `Update`, `WhileSome`, `Combinations`, `CombinationsWithReplacement`, `Powerset`, `RepeatN`, and `WithPosition` (#550) 33 - Implement `FusedIterator` for `Interleave`, `IntersperseWith`, and `ZipLongest` (#548) 34 35## 0.10.0 36 - **Increase minimum supported Rust version to 1.32.0** 37 - Improve macro hygiene (#507) 38 - Add `Itertools::powerset` (#335) 39 - Add `Itertools::sorted_unstable`, `Itertools::sorted_unstable_by`, and `Itertools::sorted_unstable_by_key` (#494) 40 - Implement `Error` for `ExactlyOneError` (#484) 41 - Undeprecate `Itertools::fold_while` (#476) 42 - Tuple-related adapters work for tuples of arity up to 12 (#475) 43 - `use_alloc` feature for users who have `alloc`, but not `std` (#474) 44 - Add `Itertools::k_smallest` (#473) 45 - Add `Itertools::into_grouping_map` and `GroupingMap` (#465) 46 - Add `Itertools::into_grouping_map_by` and `GroupingMapBy` (#465) 47 - Add `Itertools::counts` (#468) 48 - Add implementation of `DoubleEndedIterator` for `Unique` (#442) 49 - Add implementation of `DoubleEndedIterator` for `UniqueBy` (#442) 50 - Add implementation of `DoubleEndedIterator` for `Zip` (#346) 51 - Add `Itertools::multipeek` (#435) 52 - Add `Itertools::dedup_with_count` and `DedupWithCount` (#423) 53 - Add `Itertools::dedup_by_with_count` and `DedupByWithCount` (#423) 54 - Add `Itertools::intersperse_with` and `IntersperseWith` (#381) 55 - Add `Itertools::filter_ok` and `FilterOk` (#377) 56 - Add `Itertools::filter_map_ok` and `FilterMapOk` (#377) 57 - Deprecate `Itertools::fold_results`, use `Itertools::fold_ok` instead (#377) 58 - Deprecate `Itertools::map_results`, use `Itertools::map_ok` instead (#377) 59 - Deprecate `FoldResults`, use `FoldOk` instead (#377) 60 - Deprecate `MapResults`, use `MapOk` instead (#377) 61 - Add `Itertools::circular_tuple_windows` and `CircularTupleWindows` (#350) 62 - Add `peek_nth` and `PeekNth` (#303) 63 64## 0.9.0 65 - Fix potential overflow in `MergeJoinBy::size_hint` (#385) 66 - Add `derive(Clone)` where possible (#382) 67 - Add `try_collect` method (#394) 68 - Add `HomogeneousTuple` trait (#389) 69 - Fix `combinations(0)` and `combinations_with_replacement(0)` (#383) 70 - Don't require `ParitalEq` to the `Item` of `DedupBy` (#397) 71 - Implement missing specializations on the `PutBack` adaptor and on the `MergeJoinBy` iterator (#372) 72 - Add `position_*` methods (#412) 73 - Derive `Hash` for `EitherOrBoth` (#417) 74 - Increase minimum supported Rust version to 1.32.0 75 76## 0.8.2 77 - Use `slice::iter` instead of `into_iter` to avoid future breakage (#378, by @LukasKalbertodt) 78## 0.8.1 79 - Added a [`.exactly_one()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.exactly_one) iterator method that, on success, extracts the single value of an iterator ; by @Xaeroxe 80 - Added combinatory iterator adaptors: 81 - [`.permutations(k)`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.permutations): 82 83 `[0, 1, 2].iter().permutations(2)` yields 84 85 ```rust 86 [ 87 vec![0, 1], 88 vec![0, 2], 89 vec![1, 0], 90 vec![1, 2], 91 vec![2, 0], 92 vec![2, 1], 93 ] 94 ``` 95 96 ; by @tobz1000 97 98 - [`.combinations_with_replacement(k)`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.combinations_with_replacement): 99 100 `[0, 1, 2].iter().combinations_with_replacement(2)` yields 101 102 ```rust 103 [ 104 vec![0, 0], 105 vec![0, 1], 106 vec![0, 2], 107 vec![1, 1], 108 vec![1, 2], 109 vec![2, 2], 110 ] 111 ``` 112 113 ; by @tommilligan 114 115 - For reference, these methods join the already existing [`.combinations(k)`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.combinations): 116 117 `[0, 1, 2].iter().combinations(2)` yields 118 119 ```rust 120 [ 121 vec![0, 1], 122 vec![0, 2], 123 vec![1, 2], 124 ] 125 ``` 126 127 - Improved the performance of [`.fold()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.fold)-based internal iteration for the [`.intersperse()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.intersperse) iterator ; by @jswrenn 128 - Added [`.dedup_by()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.dedup_by), [`.merge_by()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.merge_by) and [`.kmerge_by()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.kmerge_by) adaptors that work like [`.dedup()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.dedup), [`.merge()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.merge) and [`.kmerge()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.kmerge), but taking an additional custom comparison closure parameter. ; by @phimuemue 129 - Improved the performance of [`.all_equal()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.all_equal) ; by @fyrchik 130 - Loosened the bounds on [`.partition_map()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.partition_map) to take just a `FnMut` closure rather than a `Fn` closure, and made its implementation use internal iteration for better performance ; by @danielhenrymantilla 131 - Added convenience methods to [`EitherOrBoth`](https://docs.rs/itertools/0.8.1/itertools/enum.EitherOrBoth.html) elements yielded from the [`.zip_longest()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.zip_longest) iterator adaptor ; by @Avi-D-coder 132 - Added [`.sum1()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.sum1) and [`.product1()`](https://docs.rs/itertools/0.8.1/itertools/trait.Itertools.html#method.product1) iterator methods that respectively try to return the sum and the product of the elements of an iterator **when it is not empty**, otherwise they return `None` ; by @Emerentius 133## 0.8.0 134 - Added new adaptor `.map_into()` for conversions using `Into` by @vorner 135 - Improved `Itertools` docs by @JohnHeitmann 136 - The return type of `.sorted_by_by_key()` is now an iterator, not a Vec. 137 - The return type of the `izip!(x, y)` macro with exactly two arguments is now the usual `Iterator::zip`. 138 - Remove `.flatten()` in favour of std's `.flatten()` 139 - Deprecate `.foreach()` in favour of std's `.for_each()` 140 - Deprecate `.step()` in favour of std's `.step_by()` 141 - Deprecate `repeat_call` in favour of std's `repeat_with` 142 - Deprecate `.fold_while()` in favour of std's `.try_fold()` 143 - Require Rust 1.24 as minimal version. 144## 0.7.11 145 - Add convenience methods to `EitherOrBoth`, making it more similar to `Option` and `Either` by @jethrogb 146## 0.7.10 147 - No changes. 148## 0.7.9 149 - New inclusion policy: See the readme about suggesting features for std before accepting them in itertools. 150 - The `FoldWhile` type now implements `Eq` and `PartialEq` by @jturner314 151## 0.7.8 152 - Add new iterator method `.tree_fold1()` which is like `.fold1()` except items are combined in a tree structure (see its docs). By @scottmcm 153 - Add more `Debug` impls by @phimuemue: KMerge, KMergeBy, MergeJoinBy, ConsTuples, Intersperse, ProcessResults, RcIter, Tee, TupleWindows, Tee, ZipLongest, ZipEq, Zip. 154## 0.7.7 155 - Add new iterator method `.into_group_map() -> HashMap<K, Vec<V>>` which turns an iterator of `(K, V)` elements into such a hash table, where values are grouped by key. By @tobz1000 156 - Add new free function `flatten` for the `.flatten()` adaptor. **NOTE:** recent Rust nightlies have `Iterator::flatten` and thus a clash with our flatten adaptor. One workaround is to use the itertools `flatten` free function. 157## 0.7.6 158 - Add new adaptor `.multi_cartesian_product()` which is an n-ary product iterator by @tobz1000 159 - Add new method `.sorted_by_key()` by @Xion 160 - Provide simpler and faster `.count()` for `.unique()` and `.unique_by()` 161## 0.7.5 162 - `.multipeek()` now implements `PeekingNext`, by @nicopap. 163## 0.7.4 164 - Add new adaptor `.update()` by @lucasem; this adaptor is used to modify an element before passing it on in an iterator chain. 165## 0.7.3 166 - Add new method `.collect_tuple()` by @matklad; it makes a tuple out of the iterator's elements if the number of them matches **exactly**. 167 - Implement `fold` and `collect` for `.map_results()` which means it reuses the code of the standard `.map()` for these methods. 168## 0.7.2 169 - Add new adaptor `.merge_join_by` by @srijs; a heterogeneous merge join for two ordered sequences. 170## 0.7.1 171 - Iterator adaptors and iterators in itertools now use the same `must_use` reminder that the standard library adaptors do, by @matematikaedit and @bluss *“iterator adaptors are lazy and do nothing unless consumed”*. 172## 0.7.0 173 - Faster `izip!()` by @krdln 174 - `izip!()` is now a wrapper for repeated regular `.zip()` and a single `.map()`. This means it optimizes as well as the standard library `.zip()` it uses. **Note:** `multizip` and `izip!()` are now different! The former has a named type but the latter optimizes better. 175 - Faster `.unique()` 176 - `no_std` support, which is opt-in! 177 - Many lovable features are still there without std, like `izip!()` or `.format()` or `.merge()`, but not those that use collections. 178 - Trait bounds were required up front instead of just on the type: `group_by`'s `PartialEq` by @Phlosioneer and `repeat_call`'s `FnMut`. 179 - Removed deprecated constructor `Zip::new` — use `izip!()` or `multizip()` 180## 0.6.5 181 - Fix bug in `.cartesian_product()`'s fold (which only was visible for unfused iterators). 182## 0.6.4 183 - Add specific `fold` implementations for `.cartesian_product()` and `cons_tuples()`, which improves their performance in fold, foreach, and iterator consumers derived from them. 184## 0.6.3 185 - Add iterator adaptor `.positions(predicate)` by @tmccombs 186## 0.6.2 187 - Add function `process_results` which can “lift” a function of the regular values of an iterator so that it can process the `Ok` values from an iterator of `Results` instead, by @shepmaster 188 - Add iterator method `.concat()` which combines all iterator elements into a single collection using the `Extend` trait, by @srijs 189## 0.6.1 190 - Better size hint testing and subsequent size hint bugfixes by @rkarp. Fixes bugs in product, `interleave_shortest` size hints. 191 - New iterator method `.all_equal()` by @phimuemue 192## 0.6.0 193 - Deprecated names were removed in favour of their replacements 194 - `.flatten()` does not implement double ended iteration anymore 195 - `.fold_while()` uses `&mut self` and returns `FoldWhile<T>`, for composability #168 196 - `.foreach()` and `.fold1()` use `self`, like `.fold()` does. 197 - `.combinations(0)` now produces a single empty vector. #174 198## 0.5.10 199 - Add itertools method `.kmerge_by()` (and corresponding free function) 200 - Relaxed trait requirement of `.kmerge()` and `.minmax()` to PartialOrd. 201## 0.5.9 202 - Add multipeek method `.reset_peek()` 203 - Add categories 204## 0.5.8 205 - Add iterator adaptor `.peeking_take_while()` and its trait `PeekingNext`. 206## 0.5.7 207 - Add iterator adaptor `.with_position()` 208 - Fix multipeek's performance for long peeks by using `VecDeque`. 209## 0.5.6 210 - Add `.map_results()` 211## 0.5.5 212 - Many more adaptors now implement `Debug` 213 - Add free function constructor `repeat_n`. `RepeatN::new` is now deprecated. 214## 0.5.4 215 - Add infinite generator function `iterate`, that takes a seed and a closure. 216## 0.5.3 217 - Special-cased `.fold()` for flatten and put back. `.foreach()` now uses fold on the iterator, to pick up any iterator specific loop implementation. 218 - `.combinations(n)` asserts up front that `n != 0`, instead of running into an error on the second iterator element. 219## 0.5.2 220 - Add `.tuples::<T>()` that iterates by two, three or four elements at a time (where `T` is a tuple type). 221 - Add `.tuple_windows::<T>()` that iterates using a window of the two, three or four most recent elements. 222 - Add `.next_tuple::<T>()` method, that picks the next two, three or four elements in one go. 223 - `.interleave()` now has an accurate size hint. 224## 0.5.1 225 - Workaround module/function name clash that made racer crash on completing itertools. Only internal changes needed. 226## 0.5.0 227 - [Release announcement](https://bluss.github.io/rust/2016/09/26/itertools-0.5.0/) 228 - Renamed: 229 - `combinations` is now `tuple_combinations` 230 - `combinations_n` to `combinations` 231 - `group_by_lazy`, `chunks_lazy` to `group_by`, `chunks` 232 - `Unfold::new` to `unfold()` 233 - `RepeatCall::new` to `repeat_call()` 234 - `Zip::new` to `multizip` 235 - `PutBack::new`, `PutBackN::new` to `put_back`, `put_back_n` 236 - `PutBack::with_value` is now a builder setter, not a constructor 237 - `MultiPeek::new`, `.multipeek()` to `multipeek()` 238 - `format` to `format_with` and `format_default` to `format` 239 - `.into_rc()` to `rciter` 240 - `Partition` enum is now `Either` 241 - Module reorganization: 242 - All iterator structs are under `itertools::structs` but also reexported to the top level, for backwards compatibility 243 - All free functions are reexported at the root, `itertools::free` will be removed in the next version 244 - Removed: 245 - `ZipSlices`, use `.zip()` instead 246 - `.enumerate_from()`, `ZipTrusted`, due to being unstable 247 - `.mend_slices()`, moved to crate `odds` 248 - Stride, StrideMut, moved to crate `odds` 249 - `linspace()`, moved to crate `itertools-num` 250 - `.sort_by()`, use `.sorted_by()` 251 - `.is_empty_hint()`, use `.size_hint()` 252 - `.dropn()`, use `.dropping()` 253 - `.map_fn()`, use `.map()` 254 - `.slice()`, use `.take()` / `.skip()` 255 - helper traits in `misc` 256 - `new` constructors on iterator structs, use `Itertools` trait or free functions instead 257 - `itertools::size_hint` is now private 258 - Behaviour changes: 259 - `format` and `format_with` helpers now panic if you try to format them more than once. 260 - `repeat_call` is not double ended anymore 261 - New features: 262 - tuple flattening iterator is constructible with `cons_tuples` 263 - itertools reexports `Either` from the `either` crate. `Either<L, R>` is an iterator when `L, R` are. 264 - `MinMaxResult` now implements `Copy` and `Clone` 265 - `tuple_combinations` supports 1-4 tuples of combinations (previously just 2) 266## 0.4.19 267 - Add `.minmax_by()` 268 - Add `itertools::free::cloned` 269 - Add `itertools::free::rciter` 270 - Improve `.step(n)` slightly to take advantage of specialized Fuse better. 271## 0.4.18 272 - Only changes related to the "unstable" crate feature. This feature is more or less deprecated. 273 - Use deprecated warnings when unstable is enabled. `.enumerate_from()` will be removed imminently since it's using a deprecated libstd trait. 274## 0.4.17 275 - Fix bug in `.kmerge()` that caused it to often produce the wrong order #134 276## 0.4.16 277 - Improve precision of the `interleave_shortest` adaptor's size hint (it is now computed exactly when possible). 278## 0.4.15 279 - Fixup on top of the workaround in 0.4.14. A function in `itertools::free` was removed by mistake and now it is added back again. 280## 0.4.14 281 - Workaround an upstream regression in a Rust nightly build that broke compilation of of `itertools::free::{interleave, merge}` 282## 0.4.13 283 - Add `.minmax()` and `.minmax_by_key()`, iterator methods for finding both minimum and maximum in one scan. 284 - Add `.format_default()`, a simpler version of `.format()` (lazy formatting for iterators). 285## 0.4.12 286 - Add `.zip_eq()`, an adaptor like `.zip()` except it ensures iterators of inequal length don't pass silently (instead it panics). 287 - Add `.fold_while()`, an iterator method that is a fold that can short-circuit. 288 - Add `.partition_map()`, an iterator method that can separate elements into two collections. 289## 0.4.11 290 - Add `.get()` for `Stride{,Mut}` and `.get_mut()` for `StrideMut` 291## 0.4.10 292 - Improve performance of `.kmerge()` 293## 0.4.9 294 - Add k-ary merge adaptor `.kmerge()` 295 - Fix a bug in `.islice()` with ranges `a..b` where a `> b`. 296## 0.4.8 297 - Implement `Clone`, `Debug` for `Linspace` 298## 0.4.7 299 - Add function `diff_with()` that compares two iterators 300 - Add `.combinations_n()`, an n-ary combinations iterator 301 - Add methods `PutBack::with_value` and `PutBack::into_parts`. 302## 0.4.6 303 - Add method `.sorted()` 304 - Add module `itertools::free` with free function variants of common iterator adaptors and methods. For example `enumerate(iterable)`, `rev(iterable)`, and so on. 305## 0.4.5 306 - Add `.flatten()` 307## 0.4.4 308 - Allow composing `ZipSlices` with itself 309## 0.4.3 310 - Write `iproduct!()` as a single expression; this allows temporary values in its arguments. 311## 0.4.2 312 - Add `.fold_options()` 313 - Require Rust 1.1 or later 314## 0.4.1 315 - Update `.dropping()` to take advantage of `.nth()` 316## 0.4.0 317 - `.merge()`, `.unique()` and `.dedup()` now perform better due to not using function pointers 318 - Add free functions `enumerate()` and `rev()` 319 - Breaking changes: 320 - Return types of `.merge()` and `.merge_by()` renamed and changed 321 - Method `Merge::new` removed 322 - `.merge_by()` now takes a closure that returns bool. 323 - Return type of `.dedup()` changed 324 - Return type of `.mend_slices()` changed 325 - Return type of `.unique()` changed 326 - Removed function `times()`, struct `Times`: use a range instead 327 - Removed deprecated macro `icompr!()` 328 - Removed deprecated `FnMap` and method `.fn_map()`: use `.map_fn()` 329 - `.interleave_shortest()` is no longer guaranteed to act like fused 330## 0.3.25 331 - Rename `.sort_by()` to `.sorted_by()`. Old name is deprecated. 332 - Fix well-formedness warnings from RFC 1214, no user visible impact 333## 0.3.24 334 - Improve performance of `.merge()`'s ordering function slightly 335## 0.3.23 336 - Added `.chunks()`, similar to (and based on) `.group_by_lazy()`. 337 - Tweak linspace to match numpy.linspace and make it double ended. 338## 0.3.22 339 - Added `ZipSlices`, a fast zip for slices 340## 0.3.21 341 - Remove `Debug` impl for `Format`, it will have different use later 342## 0.3.20 343 - Optimize `.group_by_lazy()` 344## 0.3.19 345 - Added `.group_by_lazy()`, a possibly nonallocating group by 346 - Added `.format()`, a nonallocating formatting helper for iterators 347 - Remove uses of `RandomAccessIterator` since it has been deprecated in Rust. 348## 0.3.17 349 - Added (adopted) `Unfold` from Rust 350## 0.3.16 351 - Added adaptors `.unique()`, `.unique_by()` 352## 0.3.15 353 - Added method `.sort_by()` 354## 0.3.14 355 - Added adaptor `.while_some()` 356## 0.3.13 357 - Added adaptor `.interleave_shortest()` 358 - Added adaptor `.pad_using()` 359## 0.3.11 360 - Added `assert_equal` function 361## 0.3.10 362 - Bugfix `.combinations()` `size_hint`. 363## 0.3.8 364 - Added source `RepeatCall` 365## 0.3.7 366 - Added adaptor `PutBackN` 367 - Added adaptor `.combinations()` 368## 0.3.6 369 - Added `itertools::partition`, partition a sequence in place based on a predicate. 370 - Deprecate `icompr!()` with no replacement. 371## 0.3.5 372 - `.map_fn()` replaces deprecated `.fn_map()`. 373## 0.3.4 374 - `.take_while_ref()` *by-ref adaptor* 375 - `.coalesce()` *adaptor* 376 - `.mend_slices()` *adaptor* 377## 0.3.3 378 - `.dropping_back()` *method* 379 - `.fold1()` *method* 380 - `.is_empty_hint()` *method* 381