Skip to content

Commit

Permalink
Replace futures-lite with pollster
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Jan 28, 2023
1 parent c9e1edd commit 51e2f57
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 22 deletions.
10 changes: 8 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion boa_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde_json = "1.0.91"
colored = "2.0.0"
regex = "1.7.1"
phf = { version = "0.11.1", features = ["macros"] }
futures-lite = "1.12.0"
pollster = "0.2.5"

[features]
default = ["intl"]
Expand Down
2 changes: 1 addition & 1 deletion boa_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl JobQueue for Jobs {
}

fn enqueue_future_job(&self, future: FutureJob, _: &mut Context<'_>) {
let job = futures_lite::future::block_on(future);
let job = pollster::block_on(future);
self.0.borrow_mut().push_front(job);
}
}
16 changes: 2 additions & 14 deletions boa_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@ rust-version.workspace = true
[features]
profiler = ["boa_profiler/profiler"]
deser = ["boa_interner/serde", "boa_ast/serde"]
intl = [
"dep:boa_icu_provider",
"dep:icu_locid_transform",
"dep:icu_locid",
"dep:icu_datetime",
"dep:icu_plurals",
"dep:icu_provider",
"dep:icu_calendar",
"dep:icu_collator",
"dep:icu_list",
"dep:writeable",
"dep:sys-locale",
]
intl = ["dep:boa_icu_provider", "dep:icu_locid_transform", "dep:icu_locid", "dep:icu_datetime", "dep:icu_plurals", "dep:icu_provider", "dep:icu_calendar", "dep:icu_collator", "dep:icu_list", "dep:writeable", "dep:sys-locale"]

fuzz = ["boa_ast/arbitrary", "boa_interner/arbitrary"]

Expand Down Expand Up @@ -64,7 +52,7 @@ static_assertions = "1.1.0"
thiserror = "1.0.38"
dashmap = "5.4.0"
num_enum = "0.5.9"
futures-lite = { version = "1.12.0" }
pollster = "0.2.5"

# intl deps
boa_icu_provider = { workspace = true, optional = true }
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl NativeJob {
}
}

/// [`JobCallback`][spec] records
/// [`JobCallback`][spec] records.
///
/// [spec]: https://tc39.es/ecma262/#sec-jobcallback-records
#[derive(Trace, Finalize)]
Expand Down Expand Up @@ -232,7 +232,7 @@ impl JobQueue for SimpleJobQueue {
}

fn enqueue_future_job(&self, future: FutureJob, context: &mut Context<'_>) {
let job = futures_lite::future::block_on(future);
let job = pollster::block_on(future);
self.enqueue_promise_job(job, context);
}
}
3 changes: 1 addition & 2 deletions boa_engine/src/native_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use std::future::Future;

use boa_gc::{custom_trace, Finalize, Gc, Trace};
use futures_lite::FutureExt;

use crate::{
builtins::Promise,
Expand Down Expand Up @@ -195,7 +194,7 @@ impl NativeFunction {
};
context
.job_queue()
.enqueue_future_job(future.boxed_local(), context);
.enqueue_future_job(Box::pin(future), context);
Ok(promise.into())
})
}
Expand Down

0 comments on commit 51e2f57

Please sign in to comment.