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/compilers/json.rs | |
parent | cb00fd6e988184420f842b1e77ca4cf627d32773 (diff) |
Use futures 0.3 API (#3358)
Diffstat (limited to 'cli/compilers/json.rs')
-rw-r--r-- | cli/compilers/json.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cli/compilers/json.rs b/cli/compilers/json.rs index 22a1d5f3d..c1f63e37b 100644 --- a/cli/compilers/json.rs +++ b/cli/compilers/json.rs @@ -2,8 +2,10 @@ use crate::compilers::CompiledModule; use crate::compilers::CompiledModuleFuture; use crate::file_fetcher::SourceFile; +use crate::futures::future::FutureExt; use deno::ErrBox; use regex::Regex; +use std::pin::Pin; use std::str; // From https://github.com/mathiasbynens/mothereff.in/blob/master/js-variables/eff.js @@ -15,11 +17,11 @@ impl JsonCompiler { pub fn compile_async( self: &Self, source_file: &SourceFile, - ) -> Box<CompiledModuleFuture> { + ) -> Pin<Box<CompiledModuleFuture>> { let maybe_json_value: serde_json::Result<serde_json::Value> = serde_json::from_str(&str::from_utf8(&source_file.source_code).unwrap()); if let Err(err) = maybe_json_value { - return Box::new(futures::future::err(ErrBox::from(err))); + return futures::future::err(ErrBox::from(err)).boxed(); } let mut code = format!( @@ -50,6 +52,6 @@ impl JsonCompiler { name: source_file.url.to_string(), }; - Box::new(futures::future::ok(module)) + futures::future::ok(module).boxed() } } |