Skip to content

Commit 7397d00

Browse files
committed
Update some documentation
1 parent abfcc43 commit 7397d00

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1145,9 +1145,6 @@ pub trait Itertools : Iterator {
11451145
/// Iterator element type is `Vec<Self::Item>`. The iterator produces a new Vec per iteration,
11461146
/// and clones the iterator elements.
11471147
///
1148-
/// If the input iterator is empty, or `k` is 0, or `k` greater than the
1149-
/// length of the input iterator, the resultant iterator adaptor will be empty.
1150-
///
11511148
/// ```
11521149
/// use itertools::Itertools;
11531150
///
@@ -1243,6 +1240,8 @@ pub trait Itertools : Iterator {
12431240
/// ]);
12441241
/// ```
12451242
///
1243+
/// Note: The source iterator is collected lazily, and will not be
1244+
/// re-iterated if the permutations adaptor is completed and re-iterated.
12461245
#[cfg(feature = "use_std")]
12471246
fn permutations(self, k: usize) -> Permutations<Self>
12481247
where Self: Sized,

src/permutations.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@ use std::iter::once;
33

44
use super::lazy_buffer::LazyBuffer;
55

6-
/// An iterator to iterate through all the `k`-permutations of a series of items.
6+
/// An iterator adaptor that iterates through all the `k`-permutations of the
7+
/// elements from an iterator.
78
///
8-
/// Source items are distinguished by their position, not value; so if there
9-
/// are identical items in the source, there will be some identical permutation
10-
/// iterations.
11-
///
12-
/// Can be constructed from an in-memory list of items directly; or from an
13-
/// iterator, with the
14-
/// [`.permuatations()`](../trait.Itertools.html#method.permutations) method.
9+
/// See [`.permutations()`](../trait.Itertools.html#method.permutations) for
10+
/// more information.
1511
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
1612
pub struct Permutations<I: Iterator> {
1713
vals: LazyBuffer<I>,

0 commit comments

Comments
 (0)