]> git.proxmox.com Git - rustc.git/blob - src/vendor/itertools/README.rst
New upstream version 1.25.0+dfsg1
[rustc.git] / src / vendor / itertools / README.rst
1
2 Itertools
3 =========
4
5 Extra iterator adaptors, functions and macros.
6
7 Please read the `API documentation here`__
8
9 __ https://docs.rs/itertools/
10
11 |build_status|_ |crates|_
12
13 .. |build_status| image:: https://travis-ci.org/bluss/rust-itertools.svg?branch=master
14 .. _build_status: https://travis-ci.org/bluss/rust-itertools
15
16 .. |crates| image:: http://meritbadge.herokuapp.com/itertools
17 .. _crates: https://crates.io/crates/itertools
18
19 How to use with cargo:
20
21 .. code:: toml
22
23 [dependencies]
24 itertools = "0.7.3"
25
26 How to use in your crate:
27
28 .. code:: rust
29
30 #[macro_use] extern crate itertools;
31
32 use itertools::Itertools;
33
34 How to contribute:
35
36 - Fix a bug or implement a new thing
37 - Include tests for your new feature, preferably a quickcheck test
38 - Make a Pull Request
39
40
41 Recent Changes
42 --------------
43
44 - 0.7.6
45
46 - Add new adaptor ``.multi_cartesian_product()`` which is an n-ary product
47 iterator by @tobz1000
48 - Add new method ``.sorted_by_key()`` by @Xion
49 - Provide simpler and faster ``.count()`` for ``.unique()`` and ``.unique_by()``
50
51 - 0.7.5
52
53 - ``.multipeek()`` now implements ``PeekingNext``, by @nicopap.
54
55 - 0.7.4
56
57 - Add new adaptor ``.update()`` by @lucasem; this adaptor is used
58 to modify an element before passing it on in an iterator chain.
59
60 - 0.7.3
61
62 - Add new method ``.collect_tuple()`` by @matklad; it makes a tuple out of
63 the iterator's elements if the number of them matches **exactly**.
64 - Implement ``fold`` and ``collect`` for ``.map_results()`` which means
65 it reuses the code of the standard ``.map()`` for these methods.
66
67 - 0.7.2
68
69 - Add new adaptor ``.merge_join_by`` by @srijs; a heterogeneous merge join
70 for two ordered sequences.
71
72 - 0.7.1
73
74 - Iterator adaptors and iterators in itertools now use the same ``must_use``
75 reminder that the standard library adaptors do, by @matematikaedit and @bluss
76 *“iterator adaptors are lazy and do nothing unless consumed”*.
77
78 - 0.7.0
79
80 - Faster ``izip!()`` by @krdln
81
82 - ``izip!()`` is now a wrapper for repeated regular ``.zip()`` and
83 a single ``.map()``. This means it optimizes as well as the standard
84 library ``.zip()`` it uses.
85 **Note:** ``multizip`` and ``izip!()`` are now different! The former
86 has a named type but the latter optimizes better.
87
88 - Faster ``.unique()``
89
90 - ``no_std`` support, which is opt-in!
91
92 - Many lovable features are still there without std, like ``izip!()``
93 or ``.format()`` or ``.merge()``, but not those that use collections.
94
95 - Trait bounds were required up front instead of just on the type:
96 ``group_by``'s ``PartialEq`` by @Phlosioneer and ``repeat_call``'s
97 ``FnMut``.
98 - Removed deprecated constructor ``Zip::new`` — use ``izip!()`` or ``multizip()``
99
100 - 0.6.5
101
102 - Fix bug in ``.cartesian_product()``'s fold (which only was visible for
103 unfused iterators).
104
105 - 0.6.4
106
107 - Add specific ``fold`` implementations for ``.cartesian_product()`` and
108 ``cons_tuples()``, which improves their performance in fold, foreach, and
109 iterator consumers derived from them.
110
111 - 0.6.3
112
113 - Add iterator adaptor ``.positions(predicate)`` by @tmccombs
114
115 - 0.6.2
116
117 - Add function ``process_results`` which can “lift” a function of the regular
118 values of an iterator so that it can process the ``Ok`` values from an
119 iterator of ``Results`` instead, by @shepmaster
120 - Add iterator method ``.concat()`` which combines all iterator elements
121 into a single collection using the ``Extend`` trait, by @srijs
122
123 - 0.6.1
124
125 - Better size hint testing and subsequent size hint bugfixes by @rkarp.
126 Fixes bugs in product, interleave_shortest size hints.
127 - New iterator method ``.all_equal()`` by @phimuemue
128
129 - 0.6.0
130
131 - Deprecated names were removed in favour of their replacements
132 - ``.flatten()`` does not implement double ended iteration anymore
133 - ``.fold_while()`` uses ``&mut self`` and returns ``FoldWhile<T>``, for
134 composability (#168)
135 - ``.foreach()`` and ``.fold1()`` use ``self``, like ``.fold()`` does.
136 - ``.combinations(0)`` now produces a single empty vector. (#174)
137
138 - 0.5.10
139
140 - Add itertools method ``.kmerge_by()`` (and corresponding free function)
141 - Relaxed trait requirement of ``.kmerge()`` and ``.minmax()`` to PartialOrd.
142
143 - 0.5.9
144
145 - Add multipeek method ``.reset_peek()``
146 - Add categories
147
148 - 0.5.8
149
150 - Add iterator adaptor ``.peeking_take_while()`` and its trait ``PeekingNext``.
151
152 - 0.5.7
153
154 - Add iterator adaptor ``.with_position()``
155 - Fix multipeek's performance for long peeks by using ``VecDeque``.
156
157 - 0.5.6
158
159 - Add ``.map_results()``
160
161 - 0.5.5
162
163 - Many more adaptors now implement ``Debug``
164 - Add free function constructor ``repeat_n``. ``RepeatN::new`` is now
165 deprecated.
166
167 - 0.5.4
168
169 - Add infinite generator function ``iterate``, that takes a seed and a
170 closure.
171
172 - 0.5.3
173
174 - Special-cased ``.fold()`` for flatten and put back. ``.foreach()``
175 now uses fold on the iterator, to pick up any iterator specific loop
176 implementation.
177 - ``.combinations(n)`` asserts up front that ``n != 0``, instead of
178 running into an error on the second iterator element.
179
180 - 0.5.2
181
182 - Add ``.tuples::<T>()`` that iterates by two, three or four elements at
183 a time (where ``T`` is a tuple type).
184 - Add ``.tuple_windows::<T>()`` that iterates using a window of the
185 two, three or four most recent elements.
186 - Add ``.next_tuple::<T>()`` method, that picks the next two, three or four
187 elements in one go.
188 - ``.interleave()`` now has an accurate size hint.
189
190 - 0.5.1
191
192 - Workaround module/function name clash that made racer crash on completing
193 itertools. Only internal changes needed.
194
195 - 0.5.0
196
197 - `Release announcement <http://bluss.github.io/rust/2016/09/26/itertools-0.5.0/>`_
198 - Renamed:
199
200 - combinations is now tuple_combinations
201 - combinations_n to combinations
202 - group_by_lazy, chunks_lazy to group_by, chunks
203 - Unfold::new to unfold()
204 - RepeatCall::new to repeat_call()
205 - Zip::new to multizip
206 - PutBack::new, PutBackN::new to put_back, put_back_n
207 - PutBack::with_value is now a builder setter, not a constructor
208 - MultiPeek::new, .multipeek() to multipeek()
209 - format to format_with and format_default to format
210 - .into_rc() to rciter
211 - ``Partition`` enum is now ``Either``
212
213 - Module reorganization:
214
215 - All iterator structs are under ``itertools::structs`` but also
216 reexported to the top level, for backwards compatibility
217 - All free functions are reexported at the root, ``itertools::free`` will
218 be removed in the next version
219
220 - Removed:
221
222 - ZipSlices, use .zip() instead
223 - .enumerate_from(), ZipTrusted, due to being unstable
224 - .mend_slices(), moved to crate odds
225 - Stride, StrideMut, moved to crate odds
226 - linspace(), moved to crate itertools-num
227 - .sort_by(), use .sorted_by()
228 - .is_empty_hint(), use .size_hint()
229 - .dropn(), use .dropping()
230 - .map_fn(), use .map()
231 - .slice(), use .take() / .skip()
232 - helper traits in misc
233 - ``new`` constructors on iterator structs, use Itertools trait or free
234 functions instead
235 - ``itertools::size_hint`` is now private
236
237 - Behaviour changes:
238
239 - format and format_with helpers now panic if you try to format them more
240 than once.
241 - ``repeat_call`` is not double ended anymore
242
243 - New features:
244
245 - tuple flattening iterator is constructible with ``cons_tuples``
246 - itertools reexports ``Either`` from the ``either`` crate. ``Either<L, R>``
247 is an iterator when ``L, R`` are.
248 - ``MinMaxResult`` now implements Copy and Clone
249 - tuple_combinations supports 1-4 tuples of combinations (previously just 2)
250
251 - 0.4.19
252
253 - Add ``.minmax_by()``
254 - Add ``itertools::free::cloned``
255 - Add ``itertools::free::rciter``
256 - Improve ``.step(n)`` slightly to take advantage of specialized Fuse better.
257
258 - 0.4.18
259
260 - Only changes related to the "unstable" crate feature. This feature is more
261 or less deprecated.
262
263 - Use deprecated warnings when unstable is enabled. .enumerate_from() will
264 be removed imminently since it's using a deprecated libstd trait.
265
266 - 0.4.17
267
268 - Fix bug in .kmerge() that caused it to often produce the wrong order (#134)
269
270 - 0.4.16
271
272 - Improve precision of the interleave_shortest adaptor's size hint (it is
273 now computed exactly when possible).
274
275 - 0.4.15
276
277 - Fixup on top of the workaround in 0.4.14. A function in itertools::free was
278 removed by mistake and now it is added back again.
279
280 - 0.4.14
281
282 - Workaround an upstream regression in a rust nightly build that broke
283 compilation of of itertools::free::{interleave, merge}
284
285 - 0.4.13
286
287 - Add .minmax() and .minmax_by_key(), iterator methods for finding both minimum
288 and maximum in one scan.
289 - Add .format_default(), a simpler version of .format() (lazy formatting
290 for iterators).
291
292 - 0.4.12
293
294 - Add .zip_eq(), an adaptor like .zip() except it ensures iterators
295 of inequal length don't pass silently (instead it panics).
296 - Add .fold_while(), an iterator method that is a fold that
297 can short-circuit.
298 - Add .partition_map(), an iterator method that can separate elements
299 into two collections.
300
301 - 0.4.11
302
303 - Add .get() for Stride{,Mut} and .get_mut() for StrideMut
304
305 - 0.4.10
306
307 - Improve performance of .kmerge()
308
309 - 0.4.9
310
311 - Add k-ary merge adaptor .kmerge()
312 - Fix a bug in .islice() with ranges a..b where a > b.
313
314 - 0.4.8
315
316 - Implement Clone, Debug for Linspace
317
318 - 0.4.7
319
320 - Add function diff_with() that compares two iterators
321 - Add .combinations_n(), an n-ary combinations iterator
322 - Add methods PutBack::with_value and PutBack::into_parts.
323
324 - 0.4.6
325
326 - Add method .sorted()
327 - Add module ``itertools::free`` with free function variants of common
328 iterator adaptors and methods.
329 For example ``enumerate(iterable)``, ``rev(iterable)``, and so on.
330
331 - 0.4.5
332
333 - Add .flatten()
334
335 - 0.4.4
336
337 - Allow composing ZipSlices with itself
338
339 - 0.4.3
340
341 - Write iproduct!() as a single expression; this allows temporary values
342 in its arguments.
343
344 - 0.4.2
345
346 - Add .fold_options()
347 - Require Rust 1.1 or later
348
349 - 0.4.1
350
351 - Update .dropping() to take advantage of .nth()
352
353 - 0.4.0
354
355 - .merge(), .unique() and .dedup() now perform better due to not using
356 function pointers
357 - Add free functions enumerate() and rev()
358 - Breaking changes:
359
360 - Return types of .merge() and .merge_by() renamed and changed
361 - Method Merge::new removed
362 - .merge_by() now takes a closure that returns bool.
363 - Return type of .dedup() changed
364 - Return type of .mend_slices() changed
365 - Return type of .unique() changed
366 - Removed function times(), struct Times: use a range instead
367 - Removed deprecated macro icompr!()
368 - Removed deprecated FnMap and method .fn_map(): use .map_fn()
369 - .interleave_shortest() is no longer guaranteed to act like fused
370
371 - 0.3.25
372
373 - Rename .sort_by() to .sorted_by(). Old name is deprecated.
374 - Fix well-formedness warnings from RFC 1214, no user visible impact
375
376 - 0.3.24
377
378 - Improve performance of .merge()'s ordering function slightly
379
380 - 0.3.23
381
382 - Added .chunks(), similar to (and based on) .group_by_lazy().
383 - Tweak linspace to match numpy.linspace and make it double ended.
384
385 - 0.3.22
386
387 - Added ZipSlices, a fast zip for slices
388
389 - 0.3.21
390
391 - Remove `Debug` impl for `Format`, it will have different use later
392
393 - 0.3.20
394
395 - Optimize .group_by_lazy()
396
397 - 0.3.19
398
399 - Added .group_by_lazy(), a possibly nonallocating group by
400 - Added .format(), a nonallocating formatting helper for iterators
401 - Remove uses of RandomAccessIterator since it has been deprecated in rust.
402
403 - 0.3.17
404
405 - Added (adopted) Unfold from rust
406
407 - 0.3.16
408
409 - Added adaptors .unique(), .unique_by()
410
411 - 0.3.15
412
413 - Added method .sort_by()
414
415 - 0.3.14
416
417 - Added adaptor .while_some()
418
419 - 0.3.13
420
421 - Added adaptor .interleave_shortest()
422 - Added adaptor .pad_using()
423
424 - 0.3.11
425
426 - Added assert_equal function
427
428 - 0.3.10
429
430 - Bugfix .combinations() size_hint.
431
432 - 0.3.8
433
434 - Added source RepeatCall
435
436 - 0.3.7
437
438 - Added adaptor PutBackN
439 - Added adaptor .combinations()
440
441 - 0.3.6
442
443 - Added itertools::partition, partition a sequence in place based on a predicate.
444 - Deprecate icompr!() with no replacement.
445
446 - 0.3.5
447
448 - .map_fn() replaces deprecated .fn_map().
449
450 - 0.3.4
451
452 - .take_while_ref() *by-ref adaptor*
453 - .coalesce() *adaptor*
454 - .mend_slices() *adaptor*
455
456 - 0.3.3
457
458 - .dropping_back() *method*
459 - .fold1() *method*
460 - .is_empty_hint() *method*
461
462 License
463 -------
464
465 Dual-licensed to be compatible with the Rust project.
466
467 Licensed under the Apache License, Version 2.0
468 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license
469 http://opensource.org/licenses/MIT, at your
470 option. This file may not be copied, modified, or distributed
471 except according to those terms.