Trait core::iter::RandomAccessIteratorExperimental
[-]
[+]
[src]
pub trait RandomAccessIterator<A>: Iterator<A> { fn indexable(&self) -> uint; fn idx(&mut self, index: uint) -> Option<A>; }
An object implementing random access indexing by uint
A RandomAccessIterator
should be either infinite or a DoubleEndedIterator
.
Calling next()
or next_back()
on a RandomAccessIterator
reduces the indexable range accordingly. That is, it.idx(1)
will become it.idx(0)
after it.next()
is called.
Required Methods
fn indexable(&self) -> uint
Return the number of indexable elements. At most std::uint::MAX
elements are indexable, even if the iterator represents a longer range.
fn idx(&mut self, index: uint) -> Option<A>
Return an element at an index, or None
if the index is out of bounds
Implementors
impl<A, T: DoubleEndedIterator<A> + RandomAccessIterator<A>> RandomAccessIterator<A> for Rev<T>
impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T>
impl<A, T: RandomAccessIterator<A>, U: RandomAccessIterator<A>> RandomAccessIterator<A> for Chain<T, U>
impl<A, B, T: RandomAccessIterator<A>, U: RandomAccessIterator<B>> RandomAccessIterator<(A, B)> for Zip<T, U>
impl<A, B, I, F> RandomAccessIterator<B> for Map<A, B, I, F> where I: RandomAccessIterator<A>, F: FnMut(A) -> B
impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<(uint, A)> for Enumerate<T>
impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Skip<T>
impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Take<T>
impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Fuse<T>
impl<A, I, F> RandomAccessIterator<A> for Inspect<A, I, F> where I: RandomAccessIterator<A>, F: FnMut(&A)
impl<A: Clone> RandomAccessIterator<A> for Repeat<A>
impl<'a, T> RandomAccessIterator<&'a T> for Iter<'a, T>
impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T>