Skip to content

Commit

Permalink
Rollup merge of rust-lang#34688 - GuillaumeGomez:double_ended_iterato…
Browse files Browse the repository at this point in the history
…r, r=steveklabnik

Improve DoubleEndedIterator examples

Fixes rust-lang#34065.

r? @steveklabnik
  • Loading branch information
Manishearth committed Jul 8, 2016
2 parents f4ae98a + 630e4eb commit 4ee6a66
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/libcore/iter/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,16 @@ pub trait Extend<A> {
/// Basic usage:
///
/// ```
/// let numbers = vec![1, 2, 3];
/// let numbers = vec![1, 2, 3, 4, 5, 6];
///
/// 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!(Some(&6), iter.next_back());
/// assert_eq!(Some(&5), iter.next_back());
/// assert_eq!(Some(&2), iter.next());
/// assert_eq!(Some(&3), iter.next());
/// assert_eq!(Some(&4), iter.next());
/// assert_eq!(None, iter.next());
/// assert_eq!(None, iter.next_back());
/// ```
Expand All @@ -395,13 +398,16 @@ pub trait DoubleEndedIterator: Iterator {
/// Basic usage:
///
/// ```
/// let numbers = vec![1, 2, 3];
/// let numbers = vec![1, 2, 3, 4, 5, 6];
///
/// 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!(Some(&6), iter.next_back());
/// assert_eq!(Some(&5), iter.next_back());
/// assert_eq!(Some(&2), iter.next());
/// assert_eq!(Some(&3), iter.next());
/// assert_eq!(Some(&4), iter.next());
/// assert_eq!(None, iter.next());
/// assert_eq!(None, iter.next_back());
/// ```
Expand Down

0 comments on commit 4ee6a66

Please sign in to comment.