core: Stabilize FusedIterator
FusedIterator is a marker trait that promises that the implementing iterator continues to return `None` from `.next()` once it has returned `None` once (and/or `.next_back()`, if implemented). The effects of FusedIterator are already widely available through `.fuse()`, but with stable `FusedIterator`, stable Rust users can implement this trait for their iterators when appropriate.
This commit is contained in:
@@ -41,7 +41,7 @@ impl<A: Clone> DoubleEndedIterator for Repeat<A> {
|
||||
fn next_back(&mut self) -> Option<A> { Some(self.element.clone()) }
|
||||
}
|
||||
|
||||
#[unstable(feature = "fused", issue = "35602")]
|
||||
#[stable(feature = "fused", since = "1.25.0")]
|
||||
impl<A: Clone> FusedIterator for Repeat<A> {}
|
||||
|
||||
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||
@@ -259,7 +259,7 @@ impl<T> ExactSizeIterator for Empty<T> {
|
||||
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||
unsafe impl<T> TrustedLen for Empty<T> {}
|
||||
|
||||
#[unstable(feature = "fused", issue = "35602")]
|
||||
#[stable(feature = "fused", since = "1.25.0")]
|
||||
impl<T> FusedIterator for Empty<T> {}
|
||||
|
||||
// not #[derive] because that adds a Clone bound on T,
|
||||
@@ -340,7 +340,7 @@ impl<T> ExactSizeIterator for Once<T> {
|
||||
#[unstable(feature = "trusted_len", issue = "37572")]
|
||||
unsafe impl<T> TrustedLen for Once<T> {}
|
||||
|
||||
#[unstable(feature = "fused", issue = "35602")]
|
||||
#[stable(feature = "fused", since = "1.25.0")]
|
||||
impl<T> FusedIterator for Once<T> {}
|
||||
|
||||
/// Creates an iterator that yields an element exactly once.
|
||||
|
||||
Reference in New Issue
Block a user