@@ -30,10 +30,8 @@ mod filter_map;
30
30
mod find;
31
31
mod find_map;
32
32
mod fold;
33
- mod for_each;
34
33
mod fuse;
35
34
mod inspect;
36
- mod map;
37
35
mod min_by;
38
36
mod next;
39
37
mod nth;
@@ -43,7 +41,6 @@ mod skip;
43
41
mod skip_while;
44
42
mod step_by;
45
43
mod take;
46
- mod try_for_each;
47
44
mod zip;
48
45
49
46
use all:: AllFuture ;
@@ -53,18 +50,15 @@ use filter_map::FilterMap;
53
50
use find:: FindFuture ;
54
51
use find_map:: FindMapFuture ;
55
52
use fold:: FoldFuture ;
56
- use for_each:: ForEachFuture ;
57
53
use min_by:: MinByFuture ;
58
54
use next:: NextFuture ;
59
55
use nth:: NthFuture ;
60
56
use partial_cmp:: PartialCmpFuture ;
61
- use try_for_each:: TryForEeachFuture ;
62
57
63
58
pub use chain:: Chain ;
64
59
pub use filter:: Filter ;
65
60
pub use fuse:: Fuse ;
66
61
pub use inspect:: Inspect ;
67
- pub use map:: Map ;
68
62
pub use scan:: Scan ;
69
63
pub use skip:: Skip ;
70
64
pub use skip_while:: SkipWhile ;
@@ -346,37 +340,6 @@ extension_trait! {
346
340
Enumerate :: new( self )
347
341
}
348
342
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
-
380
343
#[ doc = r#"
381
344
A combinator that does something with each element in the stream, passing the value
382
345
on.
@@ -793,41 +756,6 @@ extension_trait! {
793
756
FoldFuture :: new( self , init, f)
794
757
}
795
758
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
-
831
759
#[ doc = r#"
832
760
Tests if any element of the stream matches a predicate.
833
761
@@ -999,51 +927,6 @@ extension_trait! {
999
927
Skip :: new( self , n)
1000
928
}
1001
929
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
-
1047
930
#[ doc = r#"
1048
931
'Zips up' two streams into a single stream of pairs.
1049
932
@@ -1221,11 +1104,11 @@ extension_trait! {
1221
1104
fn partial_cmp<S >(
1222
1105
self ,
1223
1106
other: S
1224
- ) -> impl Future <Output = Option <Ordering >> [ PartialCmpFuture <Self , S >]
1107
+ ) -> impl Future <Output = Option <Ordering >> + ' _ [ PartialCmpFuture <Self , S >]
1225
1108
where
1226
1109
Self : Sized + Stream ,
1227
- S : Stream ,
1228
- < Self as Stream > :: Item : PartialOrd <S :: Item >,
1110
+ S : Stream ,
1111
+ Self :: Item : PartialOrd <S :: Item >,
1229
1112
{
1230
1113
PartialCmpFuture :: new( self , other)
1231
1114
}
0 commit comments