Make `thread-pool` optional in `iced_futures`

This commit is contained in:
Héctor Ramón Jiménez 2020-01-19 11:08:47 +01:00
parent b8b0d97525
commit 35760ac68f
3 changed files with 10 additions and 2 deletions

View File

@ -10,12 +10,14 @@ documentation = "https://docs.rs/iced_futures"
keywords = ["gui", "ui", "graphics", "interface", "futures"] keywords = ["gui", "ui", "graphics", "interface", "futures"]
categories = ["gui"] categories = ["gui"]
[features]
thread-pool = ["futures/thread-pool"]
[dependencies] [dependencies]
log = "0.4" log = "0.4"
[dependencies.futures] [dependencies.futures]
version = "0.3" version = "0.3"
features = ["thread-pool"]
[dependencies.tokio] [dependencies.tokio]
version = "0.2" version = "0.2"

View File

@ -8,6 +8,7 @@ pub trait Executor {
} }
} }
#[cfg(feature = "thread-pool")]
impl Executor for futures::executor::ThreadPool { impl Executor for futures::executor::ThreadPool {
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) { fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
self.spawn_ok(future); self.spawn_ok(future);

View File

@ -16,12 +16,17 @@ debug = []
[dependencies] [dependencies]
winit = { version = "0.20.0-alpha3", git = "https://github.com/hecrj/winit", rev = "709808eb4e69044705fcb214bcc30556db761405"} winit = { version = "0.20.0-alpha3", git = "https://github.com/hecrj/winit", rev = "709808eb4e69044705fcb214bcc30556db761405"}
log = "0.4" log = "0.4"
futures = { version = "0.3", features = ["thread-pool"] } futures = "0.3"
[dependencies.iced_native] [dependencies.iced_native]
version = "0.1.0-alpha" version = "0.1.0-alpha"
path = "../native" path = "../native"
[dependencies.iced_futures]
version = "0.1.0-alpha"
path = "../futures"
features = ["thread-pool"]
[dependencies.window_clipboard] [dependencies.window_clipboard]
git = "https://github.com/hecrj/window_clipboard" git = "https://github.com/hecrj/window_clipboard"
rev = "22c6dd6c04cd05d528029b50a30c56417cd4bebf" rev = "22c6dd6c04cd05d528029b50a30c56417cd4bebf"