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> {
15
15
inner : Vec < T > ,
16
16
}
17
17
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
+ /// ```
18
37
pub fn from_iter < I : IntoIterator > ( iter : I ) -> FromIter < I :: Item > {
19
38
FromIter { inner : iter. into_iter ( ) . collect ( ) }
20
39
}
You can’t perform that action at this time.
0 commit comments