summaryrefslogtreecommitdiffstats
path: root/futures/src/executor/smol.rs
diff options
context:
space:
mode:
authorLibravatar Jayce Fayne <jayce.fayne@mailbox.org>2021-01-13 01:48:35 +0100
committerLibravatar Jayce Fayne <jayce.fayne@mailbox.org>2021-01-14 12:28:02 +0100
commitb2415eee61063d5c2b220d7b7a513d1952ce2be1 (patch)
tree2a0429981aa745132cb103d9d9bb75972e0c27b6 /futures/src/executor/smol.rs
parent92d647d1a6145e19ef9f540e02faef6a892f51fa (diff)
downloadiced-b2415eee61063d5c2b220d7b7a513d1952ce2be1.tar.gz
iced-b2415eee61063d5c2b220d7b7a513d1952ce2be1.tar.bz2
iced-b2415eee61063d5c2b220d7b7a513d1952ce2be1.zip
Add `smol` async runtime
Diffstat (limited to 'futures/src/executor/smol.rs')
-rw-r--r--futures/src/executor/smol.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/futures/src/executor/smol.rs b/futures/src/executor/smol.rs
new file mode 100644
index 00000000..deafd43a
--- /dev/null
+++ b/futures/src/executor/smol.rs
@@ -0,0 +1,18 @@
+use crate::Executor;
+
+use futures::Future;
+
+/// A `smol` runtime.
+#[cfg_attr(docsrs, doc(cfg(feature = "smol")))]
+#[derive(Debug)]
+pub struct Smol;
+
+impl Executor for Smol {
+ fn new() -> Result<Self, futures::io::Error> {
+ Ok(Self)
+ }
+
+ fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
+ smol::spawn(future).detach();
+ }
+}