Skip to content

Commit

Permalink
Merge #516
Browse files Browse the repository at this point in the history
516: Switched numbers to chars so that its clearer r=jswrenn a=gilescope

I read the docs in the IDE and I thought the example could be clearer - there were lots of numbers. 
I think this makes it clearer to read as to how the result is structured.

Co-authored-by: Giles Cope <gilescope@gmail.com>
  • Loading branch information
bors[bot] and gilescope committed Jan 17, 2021
2 parents 2d52ca2 + d7b3fa4 commit 4d902e3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/lib.rs
Expand Up @@ -1110,12 +1110,13 @@ pub trait Itertools : Iterator {
/// ```
/// use itertools::Itertools;
///
/// let data = vec![1., 1., 2., 3., 3., 2., 2.];
/// let data = vec!['a', 'a', 'b', 'c', 'c', 'b', 'b'];
/// itertools::assert_equal(data.into_iter().dedup_with_count(),
/// vec![(2, 1.), (1, 2.), (2, 3.), (2, 2.)]);
/// vec![(2, 'a'), (1, 'b'), (2, 'c'), (2, 'b')]);
/// ```
fn dedup_with_count(self) -> DedupWithCount<Self>
where Self: Sized,
where
Self: Sized,
{
adaptors::dedup_with_count(self)
}
Expand All @@ -1132,13 +1133,14 @@ pub trait Itertools : Iterator {
/// ```
/// use itertools::Itertools;
///
/// let data = vec![(0, 1.), (1, 1.), (0, 2.), (0, 3.), (1, 3.), (1, 2.), (2, 2.)];
/// let data = vec![(0, 'a'), (1, 'a'), (0, 'b'), (0, 'c'), (1, 'c'), (1, 'b'), (2, 'b')];
/// itertools::assert_equal(data.into_iter().dedup_by_with_count(|x, y| x.1 == y.1),
/// vec![(2, (0, 1.)), (1, (0, 2.)), (2, (0, 3.)), (2, (1, 2.))]);
/// vec![(2, (0, 'a')), (1, (0, 'b')), (2, (0, 'c')), (2, (1, 'b'))]);
/// ```
fn dedup_by_with_count<Cmp>(self, cmp: Cmp) -> DedupByWithCount<Self, Cmp>
where Self: Sized,
Cmp: FnMut(&Self::Item, &Self::Item) -> bool,
where
Self: Sized,
Cmp: FnMut(&Self::Item, &Self::Item) -> bool,
{
adaptors::dedup_by_with_count(self, cmp)
}
Expand Down

0 comments on commit 4d902e3

Please sign in to comment.