Skip to content

Commit 005912f

Browse files
committed
Implement last on the GroupBy and GroupByMut Iterators
1 parent e16eaea commit 005912f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/core/src/slice/iter.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,6 +3018,11 @@ where P: FnMut(&T, &T) -> bool,
30183018
(1, Some(self.slice.len()))
30193019
}
30203020
}
3021+
3022+
#[inline]
3023+
fn last(self) -> Option<Self::Item> {
3024+
self.next_back()
3025+
}
30213026
}
30223027

30233028
#[unstable(feature = "slice_group_by", issue = "0")]
@@ -3098,6 +3103,11 @@ where P: FnMut(&T, &T) -> bool,
30983103
(1, Some(self.slice.len()))
30993104
}
31003105
}
3106+
3107+
#[inline]
3108+
fn last(self) -> Option<Self::Item> {
3109+
self.next_back()
3110+
}
31013111
}
31023112

31033113
#[unstable(feature = "slice_group_by", issue = "0")]

0 commit comments

Comments
 (0)