diff --git a/src/stream/double_ended/from_iter.rs b/src/stream/double_ended/from_iter.rs index 616724f..ae424a5 100644 --- a/src/stream/double_ended/from_iter.rs +++ b/src/stream/double_ended/from_iter.rs @@ -15,6 +15,25 @@ pub struct FromIter { inner: Vec, } +/// Converts an iterator into a double-ended stream. +/// +/// # Examples +/// +/// ``` +/// # async_std::task::block_on(async { +/// # +/// use async_std::stream::double_ended::{self, DoubleEndedStreamExt}; +/// +/// let mut s = double_ended::from_iter(vec![0, 1, 2, 3]); +/// +/// assert_eq!(s.next_back().await, Some(3)); +/// assert_eq!(s.next_back().await, Some(2)); +/// assert_eq!(s.next_back().await, Some(1)); +/// assert_eq!(s.next_back().await, Some(0)); +/// assert_eq!(s.next_back().await, None); +/// # +/// # }) +/// ``` pub fn from_iter(iter: I) -> FromIter { FromIter { inner: iter.into_iter().collect() } }