diff options
author | 2021-01-13 01:48:35 +0100 | |
---|---|---|
committer | 2021-01-14 12:28:02 +0100 | |
commit | b2415eee61063d5c2b220d7b7a513d1952ce2be1 (patch) | |
tree | 2a0429981aa745132cb103d9d9bb75972e0c27b6 /futures/src/executor/smol.rs | |
parent | 92d647d1a6145e19ef9f540e02faef6a892f51fa (diff) | |
download | iced-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.rs | 18 |
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(); + } +} |