From 90690702e1e4abab804ec91e8ff4183824bec436 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 20 Jan 2020 04:47:36 +0100 Subject: Add `Application::Executor` associated type --- futures/src/executor/async_std.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 futures/src/executor/async_std.rs (limited to 'futures/src/executor/async_std.rs') diff --git a/futures/src/executor/async_std.rs b/futures/src/executor/async_std.rs new file mode 100644 index 00000000..b056b23d --- /dev/null +++ b/futures/src/executor/async_std.rs @@ -0,0 +1,15 @@ +use crate::Executor; + +use futures::Future; + +pub struct AsyncStd; + +impl Executor for AsyncStd { + fn new() -> Result { + Ok(Self) + } + + fn spawn(&self, future: impl Future + Send + 'static) { + let _ = async_std::task::spawn(future); + } +} -- cgit From f14009601e270e43bdf29b8f4842cf136fbbd8b9 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 20 Jan 2020 09:49:17 +0100 Subject: Write documentation for `iced_futures` --- futures/src/executor/async_std.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'futures/src/executor/async_std.rs') diff --git a/futures/src/executor/async_std.rs b/futures/src/executor/async_std.rs index b056b23d..641dfbd2 100644 --- a/futures/src/executor/async_std.rs +++ b/futures/src/executor/async_std.rs @@ -2,6 +2,8 @@ use crate::Executor; use futures::Future; +/// A type representing the `async-std` runtime. +#[derive(Debug)] pub struct AsyncStd; impl Executor for AsyncStd { -- cgit From 91d9d65a03ce9b211e4043726e7424949d314325 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 20 Jan 2020 10:49:25 +0100 Subject: Improve consistency in executor documentation --- futures/src/executor/async_std.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'futures/src/executor/async_std.rs') diff --git a/futures/src/executor/async_std.rs b/futures/src/executor/async_std.rs index 641dfbd2..27949e31 100644 --- a/futures/src/executor/async_std.rs +++ b/futures/src/executor/async_std.rs @@ -2,7 +2,7 @@ use crate::Executor; use futures::Future; -/// A type representing the `async-std` runtime. +/// An `async-std` runtime. #[derive(Debug)] pub struct AsyncStd; -- cgit