summaryrefslogtreecommitdiff
path: root/cli/compilers/wasm.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-11-17 01:17:47 +0100
committerRy Dahl <ry@tinyclouds.org>2019-11-16 19:17:47 -0500
commit8f9a942cb911ed017eb128e9fbeb6f9a48e69601 (patch)
tree4f56623262f84becac18546d9da3d5d9ce9c8735 /cli/compilers/wasm.rs
parentcb00fd6e988184420f842b1e77ca4cf627d32773 (diff)
Use futures 0.3 API (#3358)
Diffstat (limited to 'cli/compilers/wasm.rs')
-rw-r--r--cli/compilers/wasm.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/cli/compilers/wasm.rs b/cli/compilers/wasm.rs
index e0a715f84..30a171db4 100644
--- a/cli/compilers/wasm.rs
+++ b/cli/compilers/wasm.rs
@@ -7,11 +7,12 @@ use crate::startup_data;
use crate::state::*;
use crate::worker::Worker;
use deno::Buf;
-use futures::Future;
-use futures::IntoFuture;
+use futures::FutureExt;
+use futures::TryFutureExt;
use serde_derive::Deserialize;
use serde_json;
use std::collections::HashMap;
+use std::pin::Pin;
use std::sync::atomic::Ordering;
use std::sync::{Arc, Mutex};
use url::Url;
@@ -71,11 +72,11 @@ impl WasmCompiler {
self: &Self,
global_state: ThreadSafeGlobalState,
source_file: &SourceFile,
- ) -> Box<CompiledModuleFuture> {
+ ) -> Pin<Box<CompiledModuleFuture>> {
let cache = self.cache.clone();
let maybe_cached = { cache.lock().unwrap().get(&source_file.url).cloned() };
if let Some(m) = maybe_cached {
- return Box::new(futures::future::ok(m.clone()));
+ return futures::future::ok(m.clone()).boxed();
}
let cache_ = self.cache.clone();
@@ -92,7 +93,6 @@ impl WasmCompiler {
.into_boxed_str()
.into_boxed_bytes(),
)
- .into_future()
.then(move |_| worker)
.then(move |result| {
if let Err(err) = result {
@@ -124,9 +124,9 @@ impl WasmCompiler {
cache_.lock().unwrap().insert(url.clone(), module.clone());
}
debug!("<<<<< wasm_compile_async END");
- Ok(module)
+ futures::future::ok(module)
});
- Box::new(fut)
+ fut.boxed()
}
}