Auto merge of #28738 - apasel422:peekable, r=alexcrichton
This commit is contained in:
@@ -1862,6 +1862,7 @@ impl<I> DoubleEndedIterator for Enumerate<I> where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator with a `peek()` that returns an optional reference to the next element.
|
/// An iterator with a `peek()` that returns an optional reference to the next element.
|
||||||
|
#[derive(Clone)]
|
||||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub struct Peekable<I: Iterator> {
|
pub struct Peekable<I: Iterator> {
|
||||||
@@ -1869,15 +1870,6 @@ pub struct Peekable<I: Iterator> {
|
|||||||
peeked: Option<I::Item>,
|
peeked: Option<I::Item>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I: Iterator + Clone> Clone for Peekable<I> where I::Item: Clone {
|
|
||||||
fn clone(&self) -> Peekable<I> {
|
|
||||||
Peekable {
|
|
||||||
iter: self.iter.clone(),
|
|
||||||
peeked: self.peeked.clone(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<I: Iterator> Iterator for Peekable<I> {
|
impl<I: Iterator> Iterator for Peekable<I> {
|
||||||
type Item = I::Item;
|
type Item = I::Item;
|
||||||
|
|||||||
Reference in New Issue
Block a user