Skip to content

Commit ee2370d

Browse files
committed
Implement Iterator::last for vec::IntoIter
1 parent 092a284 commit ee2370d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: library/alloc/src/vec/into_iter.rs

+5
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
258258
self.len()
259259
}
260260

261+
#[inline]
262+
fn last(mut self) -> Option<T> {
263+
self.next_back()
264+
}
265+
261266
#[inline]
262267
fn next_chunk<const N: usize>(&mut self) -> Result<[T; N], core::array::IntoIter<T, N>> {
263268
let mut raw_ary = [const { MaybeUninit::uninit() }; N];

0 commit comments

Comments
 (0)