Add a FusedIterator trait.
This trait can be used to avoid the overhead of a fuse wrapper when an iterator is already well-behaved. Conforming to: RFC 1581 Closes: #35602
This commit is contained in:
@@ -61,6 +61,7 @@ use core::borrow;
|
||||
use core::cmp::Ordering;
|
||||
use core::fmt;
|
||||
use core::hash::{self, Hash};
|
||||
use core::iter::FusedIterator;
|
||||
use core::marker::{self, Unsize};
|
||||
use core::mem;
|
||||
use core::ops::{CoerceUnsized, Deref, DerefMut};
|
||||
@@ -529,6 +530,9 @@ impl<I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for Box<I> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
|
||||
|
||||
#[unstable(feature = "fused", issue = "35602")]
|
||||
impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
|
||||
|
||||
|
||||
/// `FnBox` is a version of the `FnOnce` intended for use with boxed
|
||||
/// closure objects. The idea is that where one would normally store a
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
#![feature(unsafe_no_drop_flag, filling_drop)]
|
||||
#![feature(unsize)]
|
||||
|
||||
#![cfg_attr(not(test), feature(raw, fn_traits, placement_new_protocol))]
|
||||
#![cfg_attr(not(test), feature(fused, raw, fn_traits, placement_new_protocol))]
|
||||
#![cfg_attr(test, feature(test, box_heap))]
|
||||
|
||||
// Allow testing this library
|
||||
|
||||
Reference in New Issue
Block a user