From 005912fce87700c5aee6185701e9c2aea3f216d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 10 Dec 2020 11:22:29 +0100 Subject: [PATCH] Implement last on the GroupBy and GroupByMut Iterators --- library/core/src/slice/iter.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index 730009568dd3..90afd00f21db 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -3018,6 +3018,11 @@ where P: FnMut(&T, &T) -> bool, (1, Some(self.slice.len())) } } + + #[inline] + fn last(self) -> Option { + self.next_back() + } } #[unstable(feature = "slice_group_by", issue = "0")] @@ -3098,6 +3103,11 @@ where P: FnMut(&T, &T) -> bool, (1, Some(self.slice.len())) } } + + #[inline] + fn last(self) -> Option { + self.next_back() + } } #[unstable(feature = "slice_group_by", issue = "0")]