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