summaryrefslogtreecommitdiffstats
path: root/futures/src/executor
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-25 03:06:24 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-25 03:06:24 +0100
commit782dd2f5222bfef5e12aa576a821da21126505b7 (patch)
treeef43d15531134d4c92dedca14682d70d0c614a00 /futures/src/executor
parenta4ad1b297e97d6c3efc196681822f127efc954cc (diff)
downloadiced-782dd2f5222bfef5e12aa576a821da21126505b7.tar.gz
iced-782dd2f5222bfef5e12aa576a821da21126505b7.tar.bz2
iced-782dd2f5222bfef5e12aa576a821da21126505b7.zip
Introduce `tokio_old` feature
This feature allows users to rely on the `0.2` version of `tokio` while the async ecosystem upgrades to the latest version.
Diffstat (limited to 'futures/src/executor')
-rw-r--r--futures/src/executor/tokio_old.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/futures/src/executor/tokio_old.rs b/futures/src/executor/tokio_old.rs
new file mode 100644
index 00000000..d64729fa
--- /dev/null
+++ b/futures/src/executor/tokio_old.rs
@@ -0,0 +1,21 @@
+use crate::Executor;
+
+use futures::Future;
+
+/// An old `tokio` runtime.
+#[cfg_attr(docsrs, doc(cfg(feature = "tokio_old")))]
+pub type TokioOld = tokio_old::runtime::Runtime;
+
+impl Executor for TokioOld {
+ fn new() -> Result<Self, futures::io::Error> {
+ tokio_old::runtime::Runtime::new()
+ }
+
+ fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
+ let _ = tokio_old::runtime::Runtime::spawn(self, future);
+ }
+
+ fn enter<R>(&self, f: impl FnOnce() -> R) -> R {
+ tokio_old::runtime::Runtime::enter(self, f)
+ }
+}