summaryrefslogtreecommitdiff
path: root/cli/repl.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-10-09 19:08:10 +0200
committerGitHub <noreply@github.com>2020-10-09 19:08:10 +0200
commitf4357f0ff9d39411f22504fcc20db6bd5dec6ddb (patch)
tree2144868cd857744558596402e356a691701b4cb3 /cli/repl.rs
parent9731cbc2881ae3052100d03662a3d69f5e3d2ae8 (diff)
refactor: Worker is not a Future (#7895)
This commit rewrites deno::Worker to not implement Future trait. Instead there are two separate methods: - Worker::poll_event_loop() - does single tick of event loop - Worker::run_event_loop() - runs event loop to completion Additionally some cleanup to Worker's field visibility was done.
Diffstat (limited to 'cli/repl.rs')
-rw-r--r--cli/repl.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/cli/repl.rs b/cli/repl.rs
index fbc37fac5..c5107d5af 100644
--- a/cli/repl.rs
+++ b/cli/repl.rs
@@ -47,7 +47,7 @@ async fn post_message_and_poll(
return result
}
- _ = &mut *worker => {
+ _ = worker.run_event_loop() => {
// A zero delay is long enough to yield the thread in order to prevent the loop from
// running hot for messages that are taking longer to resolve like for example an
// evaluation of top level await.
@@ -75,7 +75,7 @@ async fn read_line_and_poll(
result = &mut line => {
return result.unwrap();
}
- _ = &mut *worker, if poll_worker => {
+ _ = worker.run_event_loop(), if poll_worker => {
poll_worker = false;
}
_ = &mut timeout => {
@@ -92,12 +92,7 @@ pub async fn run(
// Our inspector is unable to default to the default context id so we have to specify it here.
let context_id: u32 = 1;
- let inspector = worker
- .inspector
- .as_mut()
- .expect("Inspector is not created.");
-
- let mut session = InspectorSession::new(&mut **inspector);
+ let mut session = worker.create_inspector_session();
let history_file = global_state.dir.root.join("deno_history.txt");