# Trait bitflags::__core::iter::DoubleEndedIterator [−] [src]

    pub trait DoubleEndedIterator: Iterator {
        fn next_back(&mut self) -> Option<Self::Item>;
    }

An iterator able to yield elements from both ends.

Something that implements `DoubleEndedIterator` has one extra capability over something that implements `Iterator`: the ability to also take `Item`s from the back, as well as the front.

It is important to note that both back and forth work on the same range, and do not cross: iteration is over when they meet in the middle.

In a similar fashion to the `Iterator` protocol, once a `DoubleEndedIterator` returns `None` from a `next_back()`, calling it again may or may not ever return `Some` again. `next()` and `next_back()` are interchangable for this purpose.

# Examples

Basic usage:

    let numbers = vec![1, 2, 3];

    let mut iter = numbers.iter();

    assert_eq!(Some(&1), iter.next());
    assert_eq!(Some(&3), iter.next_back());
    assert_eq!(Some(&2), iter.next_back());
    assert_eq!(None, iter.next());
    assert_eq!(None, iter.next_back());

## Required Methods

### `fn next_back(&mut self) -> Option<Self::Item>`

An iterator able to yield elements from both ends.

As this is the only method for this trait, the trait-level docs contain more details.

# Examples

Basic usage:

    let numbers = vec![1, 2, 3];

    let mut iter = numbers.iter();

    assert_eq!(Some(&1), iter.next());
    assert_eq!(Some(&3), iter.next_back());
    assert_eq!(Some(&2), iter.next_back());
    assert_eq!(None, iter.next());
    assert_eq!(None, iter.next_back());

## Implementors

- `impl DoubleEndedIterator for EscapeDefault`
- `impl<'a, A> DoubleEndedIterator for Iter<'a, A>`
- `impl<'a, A> DoubleEndedIterator for IterMut<'a, A>`
- `impl<A> DoubleEndedIterator for IntoIter<A>`
- `impl<'a, T> DoubleEndedIterator for Iter<'a, T>`
- `impl<'a, T> DoubleEndedIterator for IterMut<'a, T>`
- `impl<T> DoubleEndedIterator for IntoIter<T>`
- `impl<'a, T> DoubleEndedIterator for Drain<'a, T> where T: 'a`
- `impl<'a, T> DoubleEndedIterator for Iter<'a, T>`
- `impl<T> DoubleEndedIterator for IntoIter<T>`
- `impl<'a, T> DoubleEndedIterator for Drain<'a, T> where T: 'a`
- `impl<'a> DoubleEndedIterator for Iter<'a>`
- `impl<'a> DoubleEndedIterator for Components<'a>`
- `impl<T> DoubleEndedIterator for IntoIter<T>`
- `impl<'a, T> DoubleEndedIterator for Drain<'a, T>`
- `impl<A> DoubleEndedIterator for Range<A> where A: Clone + Step + One, &'a A: Add<&'a A>, &'a A: Sub<&'a A>, &'a A::Output == A, &'a A::Output == A`
- `impl<A> DoubleEndedIterator for RangeInclusive<A> where A: Step + One, &'a A: Add<&'a A>, &'a A: Sub<&'a A>, &'a A::Output == A, &'a A::Output == A`
- `impl<A> DoubleEndedIterator for Repeat<A> where A: Clone`
- `impl<T> DoubleEndedIterator for Empty<T>`
- `impl<T> DoubleEndedIterator for Once<T>`
- `impl<'a, I> DoubleEndedIterator for &'a mut I where I: DoubleEndedIterator + ?Sized`
- `impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator`
- `impl<'a, I, T> DoubleEndedIterator for Cloned<I> where I: DoubleEndedIterator<Item=&'a T>, T: 'a + Clone`
- `impl<A, B> DoubleEndedIterator for Chain<A, B> where B: DoubleEndedIterator<Item=A::Item>, A: DoubleEndedIterator`
- `impl<A, B> DoubleEndedIterator for Zip<A, B> where A: DoubleEndedIterator + ExactSizeIterator, B: DoubleEndedIterator + ExactSizeIterator`
- `impl<B, I, F> DoubleEndedIterator for Map<I, F> where I: DoubleEndedIterator, F: FnMut(I::Item) -> B`
- `impl<I, P> DoubleEndedIterator for Filter<I, P> where P: FnMut(&I::Item) -> bool, I: DoubleEndedIterator`
- `impl<B, I, F> DoubleEndedIterator for FilterMap<I, F> where F: FnMut(I::Item) -> Option<B>, I: DoubleEndedIterator`
- `impl<I> DoubleEndedIterator for Enumerate<I> where I: ExactSizeIterator + DoubleEndedIterator`
- `impl<I> DoubleEndedIterator for Skip<I> where I: DoubleEndedIterator + ExactSizeIterator`
- `impl<I, U, F> DoubleEndedIterator for FlatMap<I, U, F> where U: IntoIterator, I: DoubleEndedIterator, F: FnMut(I::Item) -> U, U::IntoIter: DoubleEndedIterator`
- `impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator`
- `impl<I, F> DoubleEndedIterator for Inspect<I, F> where I: DoubleEndedIterator, F: FnMut(&I::Item) -> ()`
- `impl<I> DoubleEndedIterator for Box<I> where I: DoubleEndedIterator + ?Sized`
- `impl<'a> DoubleEndedIterator for Drain<'a>`
- `impl<'a, T> DoubleEndedIterator for Iter<'a, T>`
- `impl<'a, T> DoubleEndedIterator for IterMut<'a, T>`
- `impl<T> DoubleEndedIterator for IntoIter<T>`
- `impl<'a, A> DoubleEndedIterator for Iter<'a, A>`
- `impl<'a, A> DoubleEndedIterator for IterMut<'a, A>`
- `impl<A> DoubleEndedIterator for IntoIter<A>`
- `impl<'a, T> DoubleEndedIterator for Iter<'a, T>`
- `impl<'a, T> DoubleEndedIterator for IterMut<'a, T>`
- `impl<'a, T, P> DoubleEndedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool`
- `impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool`
- `impl<'a, T> DoubleEndedIterator for Windows<'a, T>`
- `impl<'a, T> DoubleEndedIterator for Chunks<'a, T>`
- `impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T>`
- `impl<'a> DoubleEndedIterator for Chars<'a>`
- `impl<'a> DoubleEndedIterator for CharIndices<'a>`
- `impl<'a> DoubleEndedIterator for Bytes<'a>`
- `impl<'a, P> DoubleEndedIterator for Split<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a, P> DoubleEndedIterator for RSplit<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a, P> DoubleEndedIterator for SplitTerminator<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a, P> DoubleEndedIterator for RSplitTerminator<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a, P> DoubleEndedIterator for MatchIndices<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a, P> DoubleEndedIterator for RMatchIndices<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a, P> DoubleEndedIterator for Matches<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a, P> DoubleEndedIterator for RMatches<'a, P> where P: Pattern<'a>, P::Searcher: DoubleEndedSearcher<'a>`
- `impl<'a> DoubleEndedIterator for Lines<'a>`
- `impl<'a> DoubleEndedIterator for LinesAny<'a>`
- `impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> where V: 'a, K: 'a`
- `impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> where V: 'a, K: 'a`
- `impl<K, V> DoubleEndedIterator for IntoIter<K, V>`
- `impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V>`
- `impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V>`
- `impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V>`
- `impl<'a, K, V> DoubleEndedIterator for Range<'a, K, V>`
- `impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V>`
- `impl<'a, T> DoubleEndedIterator for Iter<'a, T>`
- `impl<T> DoubleEndedIterator for IntoIter<T>`
- `impl<'a, T> DoubleEndedIterator for Range<'a, T>`
- `impl<'a> DoubleEndedIterator for SplitWhitespace<'a>`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)