8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- //! Composable iterator objects
11
+ /*! Composable external iterators
12
+
13
+ The `Iterator` trait defines an interface for objects which implement iteration as a state machine.
14
+
15
+ Algorithms like `zip` are provided as `Iterator` implementations which wrap other objects
16
+ implementing the `Iterator` trait.
17
+
18
+ */
12
19
13
20
use prelude:: * ;
14
21
@@ -17,6 +24,10 @@ pub trait Iterator<A> {
17
24
fn next ( & mut self ) -> Option < A > ;
18
25
}
19
26
27
+ /// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
28
+ /// implementations of the `Iterator` trait.
29
+ ///
30
+ /// In the future these will be default methods instead of a utility trait.
20
31
pub trait IteratorUtil < A > {
21
32
fn chain ( self , other : Self ) -> ChainIterator < Self > ;
22
33
fn zip < B , U : Iterator < B > > ( self , other : U ) -> ZipIterator < Self , U > ;
@@ -31,6 +42,10 @@ pub trait IteratorUtil<A> {
31
42
fn advance ( & mut self , f : & fn ( A ) -> bool ) ;
32
43
}
33
44
45
+ /// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
46
+ /// implementations of the `Iterator` trait.
47
+ ///
48
+ /// In the future these will be default methods instead of a utility trait.
34
49
impl < A , T : Iterator < A > > IteratorUtil < A > for T {
35
50
#[ inline( always) ]
36
51
fn chain ( self , other : T ) -> ChainIterator < T > {
0 commit comments