File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 1
1
use core:: future:: Future ;
2
2
use core:: pin:: Pin ;
3
3
use core:: task:: { Context , Poll } ;
4
+ use futures:: future:: FusedFuture ;
4
5
use std:: marker:: PhantomPinned ;
5
6
6
7
use crate :: frame:: Frame ;
49
50
frame. in_scope ( || future. poll ( cx) )
50
51
}
51
52
}
53
+
54
+ impl < F : FusedFuture > FusedFuture for Framed < F > {
55
+ fn is_terminated ( & self ) -> bool {
56
+ self . future . is_terminated ( )
57
+ }
58
+ }
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ impl Location {
77
77
/// }).await
78
78
/// }
79
79
/// ```
80
- pub fn frame < F > ( self , f : F ) -> impl Future < Output = F :: Output >
80
+ pub fn frame < F > ( self , f : F ) -> crate :: Framed < F >
81
81
where
82
82
F : Future ,
83
83
{
Original file line number Diff line number Diff line change
1
+ use futures:: { future:: FusedFuture , FutureExt } ;
2
+
3
+ /// A test that frame can propagate FusedFuture.
4
+ mod util;
5
+
6
+ #[ test]
7
+ fn consolidate ( ) {
8
+ util:: model ( || util:: run ( fused_future ( ) ) ) ;
9
+ }
10
+
11
+ #[ async_backtrace:: framed]
12
+ fn fused_future ( ) -> impl FusedFuture < Output = ( ) > {
13
+ async_backtrace:: location!( ) . frame ( ready ( ) . fuse ( ) )
14
+ }
15
+
16
+ #[ async_backtrace:: framed]
17
+ async fn ready ( ) {
18
+ let dump = async_backtrace:: taskdump_tree ( true ) ;
19
+
20
+ pretty_assertions:: assert_str_eq!(
21
+ util:: strip( dump) ,
22
+ "\
23
+ ╼ fused::fused_future at backtrace/tests/fused.rs:LINE:COL
24
+ └╼ fused::ready::{{closure}} at backtrace/tests/fused.rs:LINE:COL"
25
+ ) ;
26
+ }
You can’t perform that action at this time.
0 commit comments