summaryrefslogtreecommitdiff
path: root/cli/global_timer.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/global_timer.rs
parentcb00fd6e988184420f842b1e77ca4cf627d32773 (diff)
Use futures 0.3 API (#3358)
Diffstat (limited to 'cli/global_timer.rs')
-rw-r--r--cli/global_timer.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/cli/global_timer.rs b/cli/global_timer.rs
index d3ca52f46..9ab760ab4 100644
--- a/cli/global_timer.rs
+++ b/cli/global_timer.rs
@@ -9,9 +9,10 @@
//! calls it) for an entire Isolate. This is what is implemented here.
use crate::tokio_util::panic_on_error;
-use futures::Future;
+use futures::channel::oneshot;
+use futures::future::FutureExt;
+use std::future::Future;
use std::time::Instant;
-use tokio::sync::oneshot;
use tokio::timer::Delay;
#[derive(Default)]
@@ -33,7 +34,7 @@ impl GlobalTimer {
pub fn new_timeout(
&mut self,
deadline: Instant,
- ) -> impl Future<Item = (), Error = ()> {
+ ) -> impl Future<Output = Result<(), ()>> {
if self.tx.is_some() {
self.cancel();
}
@@ -42,9 +43,10 @@ impl GlobalTimer {
let (tx, rx) = oneshot::channel();
self.tx = Some(tx);
- let delay = panic_on_error(Delay::new(deadline));
+ let delay =
+ panic_on_error(futures::compat::Compat01As03::new(Delay::new(deadline)));
let rx = panic_on_error(rx);
- delay.select(rx).then(|_| Ok(()))
+ futures::future::select(delay, rx).then(|_| futures::future::ok(()))
}
}