summaryrefslogtreecommitdiffstats
path: root/futures/src/backend/native/thread_pool.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 18:24:07 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 21:37:17 +0700
commit167be45a7db7c1f60a79116766bdf38300429c6a (patch)
tree5af48807c8d90a73775fef68a51ae549880aa388 /futures/src/backend/native/thread_pool.rs
parent5dab5a327ef643ee38ac3e42ab35212fff445631 (diff)
downloadiced-167be45a7db7c1f60a79116766bdf38300429c6a.tar.gz
iced-167be45a7db7c1f60a79116766bdf38300429c6a.tar.bz2
iced-167be45a7db7c1f60a79116766bdf38300429c6a.zip
Split `iced_futures` into different `backend` implementations
Diffstat (limited to 'futures/src/backend/native/thread_pool.rs')
-rw-r--r--futures/src/backend/native/thread_pool.rs16
1 files changed, 16 insertions, 0 deletions
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<Self, futures::io::Error> {
+ futures::executor::ThreadPool::new()
+ }
+
+ fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
+ self.spawn_ok(future);
+ }
+}