File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 47
47
#![ doc( test( attr( allow( unused_extern_crates, unused_variables) ) ) ) ]
48
48
#![ doc( html_logo_url = "https://async.rs/images/logo--hero.svg" ) ]
49
49
#![ recursion_limit = "1024" ]
50
+ #![ feature( associated_type_bounds) ]
50
51
51
52
use cfg_if:: cfg_if;
52
53
Original file line number Diff line number Diff line change
1
+ use std:: pin:: Pin ;
2
+
3
+ use crate :: stream:: { IntoStream , Stream } ;
4
+ use crate :: task:: { Context , Poll } ;
5
+
6
+ /// Real logic of both `Flatten` and `FlatMap` which simply delegate to
7
+ /// this type.
8
+ #[ derive( Clone , Debug ) ]
9
+ struct FlattenCompat < S , U > {
10
+ stream : S ,
11
+ frontiter : Option < U > ,
12
+ }
13
+ impl < S , U > FlattenCompat < S , U > {
14
+ pin_utils:: unsafe_unpinned!( stream: S ) ;
15
+ pin_utils:: unsafe_unpinned!( frontiter: Option <U >) ;
16
+
17
+ /// Adapts an iterator by flattening it, for use in `flatten()` and `flat_map()`.
18
+ pub fn new ( stream : S ) -> FlattenCompat < S , U > {
19
+ FlattenCompat {
20
+ stream,
21
+ frontiter : None ,
22
+ }
23
+ }
24
+ }
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ cfg_if! {
106
106
cfg_if ! {
107
107
if #[ cfg( any( feature = "unstable" , feature = "docs" ) ) ] {
108
108
mod merge;
109
+ mod flatten;
109
110
110
111
use std:: pin:: Pin ;
111
112
You can’t perform that action at this time.
0 commit comments