diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-11-17 01:17:47 +0100 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-11-16 19:17:47 -0500 |
commit | 8f9a942cb911ed017eb128e9fbeb6f9a48e69601 (patch) | |
tree | 4f56623262f84becac18546d9da3d5d9ce9c8735 /cli/ops/compiler.rs | |
parent | cb00fd6e988184420f842b1e77ca4cf627d32773 (diff) |
Use futures 0.3 API (#3358)
Diffstat (limited to 'cli/ops/compiler.rs')
-rw-r--r-- | cli/ops/compiler.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs index a722db6af..fdb62ca32 100644 --- a/cli/ops/compiler.rs +++ b/cli/ops/compiler.rs @@ -1,7 +1,8 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{Deserialize, JsonOp, Value}; -use crate::futures::future::join_all; -use crate::futures::Future; +use crate::futures::future::try_join_all; +use crate::futures::future::FutureExt; +use crate::futures::future::TryFutureExt; use crate::msg; use crate::ops::json_op; use crate::state::ThreadSafeState; @@ -77,7 +78,7 @@ fn op_fetch_source_files( let global_state = state.global_state.clone(); - let future = join_all(futures) + let future = try_join_all(futures) .map_err(ErrBox::from) .and_then(move |files| { // We want to get an array of futures that resolves to @@ -88,17 +89,19 @@ fn op_fetch_source_files( // compile them into JS first! // This allows TS to do correct export types. if file.media_type == msg::MediaType::Wasm { - return futures::future::Either::A( + return futures::future::Either::Left( global_state .wasm_compiler .compile_async(global_state.clone(), &file) - .and_then(|compiled_mod| Ok((file, Some(compiled_mod.code)))), + .and_then(|compiled_mod| { + futures::future::ok((file, Some(compiled_mod.code))) + }), ); } - futures::future::Either::B(futures::future::ok((file, None))) + futures::future::Either::Right(futures::future::ok((file, None))) }) .collect(); - join_all(v) + try_join_all(v) }) .and_then(move |files_with_code| { let res = files_with_code @@ -120,7 +123,7 @@ fn op_fetch_source_files( futures::future::ok(res) }); - Ok(JsonOp::Async(Box::new(future))) + Ok(JsonOp::Async(future.boxed())) } #[derive(Deserialize)] |