@@ -3,54 +3,11 @@ mod double_ended;
33mod exact_size;
44mod collect;
55mod accum;
6+ mod marker;
67
78pub use self :: iterator:: Iterator ;
89pub use self :: double_ended:: DoubleEndedIterator ;
910pub use self :: exact_size:: ExactSizeIterator ;
1011pub use self :: collect:: { FromIterator , IntoIterator , Extend } ;
1112pub use self :: accum:: { Sum , Product } ;
12-
13- /// An iterator that always continues to yield `None` when exhausted.
14- ///
15- /// Calling next on a fused iterator that has returned `None` once is guaranteed
16- /// to return [`None`] again. This trait should be implemented by all iterators
17- /// that behave this way because it allows optimizing [`Iterator::fuse`].
18- ///
19- /// Note: In general, you should not use `FusedIterator` in generic bounds if
20- /// you need a fused iterator. Instead, you should just call [`Iterator::fuse`]
21- /// on the iterator. If the iterator is already fused, the additional [`Fuse`]
22- /// wrapper will be a no-op with no performance penalty.
23- ///
24- /// [`None`]: ../../std/option/enum.Option.html#variant.None
25- /// [`Iterator::fuse`]: ../../std/iter/trait.Iterator.html#method.fuse
26- /// [`Fuse`]: ../../std/iter/struct.Fuse.html
27- #[ stable( feature = "fused" , since = "1.26.0" ) ]
28- pub trait FusedIterator : Iterator { }
29-
30- #[ stable( feature = "fused" , since = "1.26.0" ) ]
31- impl < I : FusedIterator + ?Sized > FusedIterator for & mut I { }
32-
33- /// An iterator that reports an accurate length using size_hint.
34- ///
35- /// The iterator reports a size hint where it is either exact
36- /// (lower bound is equal to upper bound), or the upper bound is [`None`].
37- /// The upper bound must only be [`None`] if the actual iterator length is
38- /// larger than [`usize::MAX`]. In that case, the lower bound must be
39- /// [`usize::MAX`], resulting in a [`.size_hint`] of `(usize::MAX, None)`.
40- ///
41- /// The iterator must produce exactly the number of elements it reported
42- /// or diverge before reaching the end.
43- ///
44- /// # Safety
45- ///
46- /// This trait must only be implemented when the contract is upheld.
47- /// Consumers of this trait must inspect [`.size_hint`]’s upper bound.
48- ///
49- /// [`None`]: ../../std/option/enum.Option.html#variant.None
50- /// [`usize::MAX`]: ../../std/usize/constant.MAX.html
51- /// [`.size_hint`]: ../../std/iter/trait.Iterator.html#method.size_hint
52- #[ unstable( feature = "trusted_len" , issue = "37572" ) ]
53- pub unsafe trait TrustedLen : Iterator { }
54-
55- #[ unstable( feature = "trusted_len" , issue = "37572" ) ]
56- unsafe impl < I : TrustedLen + ?Sized > TrustedLen for & mut I { }
13+ pub use self :: marker:: { FusedIterator , TrustedLen } ;
0 commit comments