make skip a double ended iterator
This commit is contained in:
@@ -3851,6 +3851,17 @@ impl<I> Iterator for Skip<I> where I: Iterator {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I> ExactSizeIterator for Skip<I> where I: ExactSizeIterator {}
|
||||
|
||||
#[stable(feature = "double_ended_skip_iterator", since = "1.8.0")]
|
||||
impl<I> DoubleEndedIterator for Skip<I> where I: DoubleEndedIterator + ExactSizeIterator {
|
||||
fn next_back(&mut self) -> Option<Self::Item> {
|
||||
if self.len() > 0 {
|
||||
self.iter.next_back()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An iterator that only iterates over the first `n` iterations of `iter`.
|
||||
///
|
||||
/// This `struct` is created by the [`take()`] method on [`Iterator`]. See its
|
||||
|
||||
Reference in New Issue
Block a user