Skip to content

Commit d6bc438

Browse files
committed
make RandomAccessIterator inherit from Iterator
1 parent 0522955 commit d6bc438

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libstd/iterator.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use uint;
2929
/// Conversion from an `Iterator`
3030
pub trait FromIterator<A, T: Iterator<A>> {
3131
/// Build a container with elements from an external iterator.
32-
pub fn from_iterator(iterator: &mut T) -> Self;
32+
fn from_iterator(iterator: &mut T) -> Self;
3333
}
3434

3535
/// An interface for dealing with "external iterators". These types of iterators
@@ -52,7 +52,9 @@ pub trait DoubleEndedIterator<A>: Iterator<A> {
5252
}
5353

5454
/// An object implementing random access indexing by `uint`
55-
pub trait RandomAccessIterator<A> {
55+
///
56+
/// A `RandomAccessIterator` should be either infinite or a `DoubleEndedIterator`.
57+
pub trait RandomAccessIterator<A>: Iterator<A> {
5658
/// Return the number of indexable elements. At most `std::uint::max_value`
5759
/// elements are indexable, even if the iterator represents a longer range.
5860
fn indexable(&self) -> uint;

0 commit comments

Comments
 (0)