From 167be45a7db7c1f60a79116766bdf38300429c6a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 28 Jan 2022 18:24:07 +0700 Subject: Split `iced_futures` into different `backend` implementations --- futures/src/backend/native/thread_pool.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 futures/src/backend/native/thread_pool.rs (limited to 'futures/src/backend/native/thread_pool.rs') diff --git a/futures/src/backend/native/thread_pool.rs b/futures/src/backend/native/thread_pool.rs new file mode 100644 index 00000000..6e791533 --- /dev/null +++ b/futures/src/backend/native/thread_pool.rs @@ -0,0 +1,16 @@ +//! A `ThreadPool` backend. +use futures::Future; + +/// A thread pool executor for futures. +#[cfg_attr(docsrs, doc(cfg(feature = "thread-pool")))] +pub type ThreadPool = futures::executor::ThreadPool; + +impl crate::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