@@ -30,10 +30,8 @@ mod filter_map;
3030mod find;
3131mod find_map;
3232mod fold;
33- mod for_each;
3433mod fuse;
3534mod inspect;
36- mod map;
3735mod min_by;
3836mod next;
3937mod nth;
@@ -43,7 +41,6 @@ mod skip;
4341mod skip_while;
4442mod step_by;
4543mod take;
46- mod try_for_each;
4744mod zip;
4845
4946use all:: AllFuture ;
@@ -53,18 +50,15 @@ use filter_map::FilterMap;
5350use find:: FindFuture ;
5451use find_map:: FindMapFuture ;
5552use fold:: FoldFuture ;
56- use for_each:: ForEachFuture ;
5753use min_by:: MinByFuture ;
5854use next:: NextFuture ;
5955use nth:: NthFuture ;
6056use partial_cmp:: PartialCmpFuture ;
61- use try_for_each:: TryForEeachFuture ;
6257
6358pub use chain:: Chain ;
6459pub use filter:: Filter ;
6560pub use fuse:: Fuse ;
6661pub use inspect:: Inspect ;
67- pub use map:: Map ;
6862pub use scan:: Scan ;
6963pub use skip:: Skip ;
7064pub use skip_while:: SkipWhile ;
@@ -346,37 +340,6 @@ extension_trait! {
346340 Enumerate :: new( self )
347341 }
348342
349- #[ doc = r#"
350- Takes a closure and creates a stream that calls that closure on every element of this stream.
351-
352- # Examples
353-
354- ```
355- # fn main() { async_std::task::block_on(async {
356- #
357- use async_std::prelude::*;
358- use std::collections::VecDeque;
359-
360- let s: VecDeque<_> = vec![1, 2, 3].into_iter().collect();
361- let mut s = s.map(|x| 2 * x);
362-
363- assert_eq!(s.next().await, Some(2));
364- assert_eq!(s.next().await, Some(4));
365- assert_eq!(s.next().await, Some(6));
366- assert_eq!(s.next().await, None);
367-
368- #
369- # }) }
370- ```
371- "# ]
372- fn map<B , F >( self , f: F ) -> Map <Self , F , Self :: Item , B >
373- where
374- Self : Sized ,
375- F : FnMut ( Self :: Item ) -> B ,
376- {
377- Map :: new( self , f)
378- }
379-
380343 #[ doc = r#"
381344 A combinator that does something with each element in the stream, passing the value
382345 on.
@@ -793,41 +756,6 @@ extension_trait! {
793756 FoldFuture :: new( self , init, f)
794757 }
795758
796- #[ doc = r#"
797- Call a closure on each element of the stream.
798-
799- # Examples
800-
801- ```
802- # fn main() { async_std::task::block_on(async {
803- #
804- use async_std::prelude::*;
805- use std::collections::VecDeque;
806- use std::sync::mpsc::channel;
807-
808- let (tx, rx) = channel();
809-
810- let s: VecDeque<usize> = vec![1, 2, 3].into_iter().collect();
811- let sum = s.for_each(move |x| tx.clone().send(x).unwrap()).await;
812-
813- let v: Vec<_> = rx.iter().collect();
814-
815- assert_eq!(v, vec![1, 2, 3]);
816- #
817- # }) }
818- ```
819- "# ]
820- fn for_each<F >(
821- self ,
822- f: F ,
823- ) -> impl Future <Output = ( ) > [ ForEachFuture <Self , F , Self :: Item >]
824- where
825- Self : Sized ,
826- F : FnMut ( Self :: Item ) ,
827- {
828- ForEachFuture :: new( self , f)
829- }
830-
831759 #[ doc = r#"
832760 Tests if any element of the stream matches a predicate.
833761
@@ -999,51 +927,6 @@ extension_trait! {
999927 Skip :: new( self , n)
1000928 }
1001929
1002- #[ doc = r#"
1003- Applies a falliable function to each element in a stream, stopping at first error and returning it.
1004-
1005- # Examples
1006-
1007- ```
1008- # fn main() { async_std::task::block_on(async {
1009- #
1010- use std::collections::VecDeque;
1011- use std::sync::mpsc::channel;
1012- use async_std::prelude::*;
1013-
1014- let (tx, rx) = channel();
1015-
1016- let s: VecDeque<usize> = vec![1, 2, 3].into_iter().collect();
1017- let s = s.try_for_each(|v| {
1018- if v % 2 == 1 {
1019- tx.clone().send(v).unwrap();
1020- Ok(())
1021- } else {
1022- Err("even")
1023- }
1024- });
1025-
1026- let res = s.await;
1027- drop(tx);
1028- let values: Vec<_> = rx.iter().collect();
1029-
1030- assert_eq!(values, vec![1]);
1031- assert_eq!(res, Err("even"));
1032- #
1033- # }) }
1034- ```
1035- "# ]
1036- fn try_for_each<F , E >(
1037- self ,
1038- f: F ,
1039- ) -> impl Future <Output = E > [ TryForEeachFuture <Self , F , Self :: Item , E >]
1040- where
1041- Self : Sized ,
1042- F : FnMut ( Self :: Item ) -> Result <( ) , E >,
1043- {
1044- TryForEeachFuture :: new( self , f)
1045- }
1046-
1047930 #[ doc = r#"
1048931 'Zips up' two streams into a single stream of pairs.
1049932
@@ -1221,11 +1104,11 @@ extension_trait! {
12211104 fn partial_cmp<S >(
12221105 self ,
12231106 other: S
1224- ) -> impl Future <Output = Option <Ordering >> [ PartialCmpFuture <Self , S >]
1107+ ) -> impl Future <Output = Option <Ordering >> + ' _ [ PartialCmpFuture <Self , S >]
12251108 where
12261109 Self : Sized + Stream ,
1227- S : Stream ,
1228- < Self as Stream > :: Item : PartialOrd <S :: Item >,
1110+ S : Stream ,
1111+ Self :: Item : PartialOrd <S :: Item >,
12291112 {
12301113 PartialCmpFuture :: new( self , other)
12311114 }
0 commit comments