Use futures 0.3 API (#3358)

This commit is contained in:
Bartek Iwańczuk 2019-11-17 01:17:47 +01:00 committed by Ry Dahl
parent cb00fd6e98
commit 8f9a942cb9
36 changed files with 1463 additions and 1018 deletions

View file

@ -2,6 +2,8 @@
use crate::compilers::CompiledModule;
use crate::compilers::CompiledModuleFuture;
use crate::file_fetcher::SourceFile;
use crate::futures::future::FutureExt;
use std::pin::Pin;
use std::str;
pub struct JsCompiler {}
@ -10,7 +12,7 @@ impl JsCompiler {
pub fn compile_async(
self: &Self,
source_file: &SourceFile,
) -> Box<CompiledModuleFuture> {
) -> Pin<Box<CompiledModuleFuture>> {
let module = CompiledModule {
code: str::from_utf8(&source_file.source_code)
.unwrap()
@ -18,6 +20,6 @@ impl JsCompiler {
name: source_file.url.to_string(),
};
Box::new(futures::future::ok(module))
futures::future::ok(module).boxed()
}
}