Skip to content

Document the trait extension behavior of Itertools a bit more clearly #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,35 @@
#![crate_name="itertools"]
#![cfg_attr(not(feature = "use_std"), no_std)]

//! Itertools — extra iterator adaptors, functions and macros.
//! Extra iterator adaptors, functions and macros.
//!
//! To use the iterator methods in this crate, import the [`Itertools` trait](./trait.Itertools.html):
//! To extend [`Iterator`] with methods in this crate, import
//! the [`Itertools` trait](./trait.Itertools.html):
//!
//! ```
//! use itertools::Itertools;
//! ```
//!
//! Now, new methods like [`interleave`](./trait.Itertools.html#method.interleave)
//! are available on all Iterators:
//!
//! ```
//! use itertools::Itertools;
//!
//! let it = (1..3).interleave(vec![-1, -2]);
//! itertools::assert_equal(it, vec![1, -1, 2, -2]);
//! ```
//!
//! Most iterator methods are also provided as functions:
//!
//! ```
//! use itertools::interleave;
//!
//! for elt in interleave(&[1, 2, 3], &[2, 3, 4]) {
//! /* loop body */
//! }
//! ```
//!
//! ## Crate Features
//!
//! - `use_std`
Expand All @@ -22,6 +43,7 @@
//!
//! This version of itertools requires Rust 1.12 or later.
//!
//! [`Iterator`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html
#![doc(html_root_url="https://docs.rs/itertools/0.7/")]

extern crate either;
Expand Down Expand Up @@ -289,7 +311,8 @@ macro_rules! izip {
};
}

/// The trait `Itertools`: extra iterator adaptors and methods for iterators.
/// An [`Iterator`] blanket implementation that provides extra adaptors and
/// methods.
///
/// This trait defines a number of methods. They are divided into two groups:
///
Expand All @@ -301,6 +324,8 @@ macro_rules! izip {
/// return a regular value of some other kind.
/// [`.next_tuple()`](#method.next_tuple) is an example and the first regular
/// method in the list.
///
/// [`Iterator`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html
pub trait Itertools : Iterator {
// adaptors

Expand Down