diff options
Diffstat (limited to 'src/liballoc/collections/binary_heap.rs')
| -rw-r--r-- | src/liballoc/collections/binary_heap.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 8c142a3d317..2b1e52cbf05 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -968,6 +968,11 @@ impl<'a, T> Iterator for Iter<'a, T> { fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } + + #[inline] + fn last(mut self) -> Option<&'a T> { + self.next_back() + } } #[stable(feature = "rust1", since = "1.0.0")] @@ -1023,6 +1028,11 @@ impl<T> Iterator for IntoIter<T> { fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } + + #[inline] + fn last(mut self) -> Option<T> { + self.next_back() + } } #[stable(feature = "rust1", since = "1.0.0")] @@ -1069,6 +1079,11 @@ impl<T> Iterator for Drain<'_, T> { fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } + + #[inline] + fn last(mut self) -> Option<T> { + self.next_back() + } } #[stable(feature = "drain", since = "1.6.0")] |
