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/thread_pool.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 futures/src/executor/thread_pool.rs (limited to 'futures/src/executor/thread_pool.rs') diff --git a/futures/src/executor/thread_pool.rs b/futures/src/executor/thread_pool.rs new file mode 100644 index 00000000..6393d0d5 --- /dev/null +++ b/futures/src/executor/thread_pool.rs @@ -0,0 +1,15 @@ +use crate::Executor; + +use futures::Future; + +pub type ThreadPool = futures::executor::ThreadPool; + +impl Executor for futures::executor::ThreadPool { + fn new() -> Result { + futures::executor::ThreadPool::new() + } + + fn spawn(&self, future: impl Future + Send + 'static) { + self.spawn_ok(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/thread_pool.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'futures/src/executor/thread_pool.rs') diff --git a/futures/src/executor/thread_pool.rs b/futures/src/executor/thread_pool.rs index 6393d0d5..09cb4d21 100644 --- a/futures/src/executor/thread_pool.rs +++ b/futures/src/executor/thread_pool.rs @@ -2,6 +2,7 @@ use crate::Executor; use futures::Future; +/// A thread pool for futures. pub type ThreadPool = futures::executor::ThreadPool; impl Executor for futures::executor::ThreadPool { -- 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/thread_pool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'futures/src/executor/thread_pool.rs') diff --git a/futures/src/executor/thread_pool.rs b/futures/src/executor/thread_pool.rs index 09cb4d21..1ec5bf69 100644 --- a/futures/src/executor/thread_pool.rs +++ b/futures/src/executor/thread_pool.rs @@ -2,7 +2,7 @@ use crate::Executor; use futures::Future; -/// A thread pool for futures. +/// A thread pool runtime for futures. pub type ThreadPool = futures::executor::ThreadPool; impl Executor for futures::executor::ThreadPool { -- cgit