Skip to content

Commit a2e5350

Browse files
committed
iterator: add a bit of documentation
1 parent 1d81b7b commit a2e5350

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/libcore/iterator.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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+
*/
1219

1320
use prelude::*;
1421

@@ -17,6 +24,10 @@ pub trait Iterator<A> {
1724
fn next(&mut self) -> Option<A>;
1825
}
1926

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.
2031
pub trait IteratorUtil<A> {
2132
fn chain(self, other: Self) -> ChainIterator<Self>;
2233
fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<Self, U>;
@@ -31,6 +42,10 @@ pub trait IteratorUtil<A> {
3142
fn advance(&mut self, f: &fn(A) -> bool);
3243
}
3344

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.
3449
impl<A, T: Iterator<A>> IteratorUtil<A> for T {
3550
#[inline(always)]
3651
fn chain(self, other: T) -> ChainIterator<T> {

0 commit comments

Comments
 (0)