Improve DoubleEndedIterator examples
This commit is contained in:
parent
4114b68eba
commit
630e4eb4c5
@ -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());
|
||||
/// ```
|
||||
@ -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());
|
||||
/// ```
|
||||
|
Loading…
Reference in New Issue
Block a user