fixes example to resemble std more

This commit is contained in:
Fedor Sakharov 2019-09-11 10:08:08 +03:00
parent ed944d051a
commit 2d75ffacc4
No known key found for this signature in database
GPG key ID: 93D436E666BF0FEE

View file

@ -149,16 +149,15 @@ pub trait Stream {
/// # fn main() { async_std::task::block_on(async { /// # fn main() { async_std::task::block_on(async {
/// # /// #
/// use async_std::prelude::*; /// use async_std::prelude::*;
/// use async_std::stream; /// use std::collections::VecDeque;
/// ///
/// let mut s = stream::repeat(9).take(4).enumerate(); /// let s: VecDeque<_> = vec!['a', 'b', 'c'].into_iter().collect();
/// let mut c: usize = 0; /// let mut s = s.enumerate();
///
/// assert_eq!(s.next().await, Some((0, 'a')));
/// assert_eq!(s.next().await, Some((1, 'b')));
/// assert_eq!(s.next().await, Some((2, 'c')));
/// ///
/// while let Some((i, v)) = s.next().await {
/// assert_eq!(c, i);
/// assert_eq!(v, 9);
/// c += 1;
/// }
/// # /// #
/// # }) } /// # }) }
fn enumerate(self) -> Enumerate<Self> fn enumerate(self) -> Enumerate<Self>