Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Boddlnagg committed Jun 10, 2019
1 parent ec54dba commit 8edfe32
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions examples/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ use winrt::windows::media::*;
use winrt::windows::storage::StorageFile;

fn main() {
let rt = RuntimeContext::init();
block_on(run());
rt.uninit();
}

async fn run() {
Expand Down Expand Up @@ -52,7 +50,7 @@ async fn run() {
let mut async_op = DeviceInformation::find_all_async().unwrap().fuse();

let work = async {
let mut result = None;
let result;
loop {
select! {
_ = interval.next() => {
Expand All @@ -61,13 +59,13 @@ async fn run() {
std::io::stdout().flush().unwrap();
},
res = async_op => {
result = Some(res);
result = res;
println!("");
break;
}
};
}
result.unwrap()
result
};

let device_information_collection = work.await.unwrap().unwrap();
Expand Down Expand Up @@ -99,7 +97,7 @@ async fn run() {
let mut async_op = async_op.fuse();

let work = async {
let mut result = None;
let result;
loop {
select! {
_ = interval.next() => {
Expand All @@ -108,13 +106,13 @@ async fn run() {
std::io::stdout().flush().unwrap();
},
res = async_op => {
result = Some(res);
result = res;
println!("");
break;
}
};
}
result.unwrap()
result
};

work.await
Expand Down

0 comments on commit 8edfe32

Please sign in to comment.