File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,7 @@ use winrt::windows::media::*;
20
20
use winrt:: windows:: storage:: StorageFile ;
21
21
22
22
fn main ( ) {
23
- let rt = RuntimeContext :: init ( ) ;
24
23
block_on ( run ( ) ) ;
25
- rt. uninit ( ) ;
26
24
}
27
25
28
26
async fn run ( ) {
@@ -52,7 +50,7 @@ async fn run() {
52
50
let mut async_op = DeviceInformation :: find_all_async ( ) . unwrap ( ) . fuse ( ) ;
53
51
54
52
let work = async {
55
- let mut result = None ;
53
+ let result;
56
54
loop {
57
55
select ! {
58
56
_ = interval. next( ) => {
@@ -61,13 +59,13 @@ async fn run() {
61
59
std:: io:: stdout( ) . flush( ) . unwrap( ) ;
62
60
} ,
63
61
res = async_op => {
64
- result = Some ( res) ;
62
+ result = res;
65
63
println!( "" ) ;
66
64
break ;
67
65
}
68
66
} ;
69
67
}
70
- result. unwrap ( )
68
+ result
71
69
} ;
72
70
73
71
let device_information_collection = work. await . unwrap ( ) . unwrap ( ) ;
@@ -99,7 +97,7 @@ async fn run() {
99
97
let mut async_op = async_op. fuse ( ) ;
100
98
101
99
let work = async {
102
- let mut result = None ;
100
+ let result;
103
101
loop {
104
102
select ! {
105
103
_ = interval. next( ) => {
@@ -108,13 +106,13 @@ async fn run() {
108
106
std:: io:: stdout( ) . flush( ) . unwrap( ) ;
109
107
} ,
110
108
res = async_op => {
111
- result = Some ( res) ;
109
+ result = res;
112
110
println!( "" ) ;
113
111
break ;
114
112
}
115
113
} ;
116
114
}
117
- result. unwrap ( )
115
+ result
118
116
} ;
119
117
120
118
work. await
You can’t perform that action at this time.
0 commit comments