File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,25 @@ pub struct FromIter<T> {
1515 inner : Vec < T > ,
1616}
1717
18+ /// Converts an iterator into a double-ended stream.
19+ ///
20+ /// # Examples
21+ ///
22+ /// ```
23+ /// # async_std::task::block_on(async {
24+ /// #
25+ /// use async_std::stream::double_ended::{self, DoubleEndedStreamExt};
26+ ///
27+ /// let mut s = double_ended::from_iter(vec![0, 1, 2, 3]);
28+ ///
29+ /// assert_eq!(s.next_back().await, Some(3));
30+ /// assert_eq!(s.next_back().await, Some(2));
31+ /// assert_eq!(s.next_back().await, Some(1));
32+ /// assert_eq!(s.next_back().await, Some(0));
33+ /// assert_eq!(s.next_back().await, None);
34+ /// #
35+ /// # })
36+ /// ```
1837pub fn from_iter < I : IntoIterator > ( iter : I ) -> FromIter < I :: Item > {
1938 FromIter { inner : iter. into_iter ( ) . collect ( ) }
2039}
You can’t perform that action at this time.
0 commit comments