2
2
#![ crate_name="itertools" ]
3
3
#![ cfg_attr( not( feature = "use_std" ) , no_std) ]
4
4
5
- //! Itertools — extra iterator adaptors, functions and macros.
5
+ //! Extra iterator adaptors, functions and macros.
6
6
//!
7
- //! To use the iterator methods in this crate, import the [`Itertools` trait](./trait.Itertools.html):
7
+ //! To extend [`Iterator`] with methods in this crate, import
8
+ //! the [`Itertools` trait](./trait.Itertools.html):
8
9
//!
9
10
//! ```
10
11
//! use itertools::Itertools;
11
12
//! ```
12
13
//!
14
+ //! Now, new methods like [`interleave`](./trait.Itertools.html#method.interleave)
15
+ //! are available on all Iterators:
16
+ //!
17
+ //! ```
18
+ //! use itertools::Itertools;
19
+ //!
20
+ //! let it = (1..3).interleave(vec![-1, -2]);
21
+ //! itertools::assert_equal(it, vec![1, -1, 2, -2]);
22
+ //! ```
23
+ //!
24
+ //! Most iterator methods are also provided as functions:
25
+ //!
26
+ //! ```
27
+ //! use itertools::interleave;
28
+ //!
29
+ //! for elt in interleave(&[1, 2, 3], &[2, 3, 4]) {
30
+ //! /* loop body */
31
+ //! }
32
+ //! ```
33
+ //!
13
34
//! ## Crate Features
14
35
//!
15
36
//! - `use_std`
22
43
//!
23
44
//! This version of itertools requires Rust 1.12 or later.
24
45
//!
46
+ //! [`Iterator`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html
25
47
#![ doc( html_root_url="https://docs.rs/itertools/0.7/" ) ]
26
48
27
49
extern crate either;
@@ -289,7 +311,8 @@ macro_rules! izip {
289
311
} ;
290
312
}
291
313
292
- /// The trait `Itertools`: extra iterator adaptors and methods for iterators.
314
+ /// An [`Iterator`] blanket implementation that provides extra adaptors and
315
+ /// methods.
293
316
///
294
317
/// This trait defines a number of methods. They are divided into two groups:
295
318
///
@@ -301,6 +324,8 @@ macro_rules! izip {
301
324
/// return a regular value of some other kind.
302
325
/// [`.next_tuple()`](#method.next_tuple) is an example and the first regular
303
326
/// method in the list.
327
+ ///
328
+ /// [`Iterator`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html
304
329
pub trait Itertools : Iterator {
305
330
// adaptors
306
331
0 commit comments