diff options
author | 2020-01-20 04:47:36 +0100 | |
---|---|---|
committer | 2020-01-20 04:47:36 +0100 | |
commit | 90690702e1e4abab804ec91e8ff4183824bec436 (patch) | |
tree | d3f989047f4ac5166bc5baed9febcc10af2d63a6 /winit | |
parent | 35760ac68f06e783e64e9048aff0fff6df1c09cf (diff) | |
download | iced-90690702e1e4abab804ec91e8ff4183824bec436.tar.gz iced-90690702e1e4abab804ec91e8ff4183824bec436.tar.bz2 iced-90690702e1e4abab804ec91e8ff4183824bec436.zip |
Add `Application::Executor` associated type
Diffstat (limited to '')
-rw-r--r-- | winit/Cargo.toml | 6 | ||||
-rw-r--r-- | winit/src/application.rs | 18 | ||||
-rw-r--r-- | winit/src/proxy.rs | 2 |
3 files changed, 12 insertions, 14 deletions
diff --git a/winit/Cargo.toml b/winit/Cargo.toml index ba6d5229..cef41e9c 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -16,17 +16,11 @@ debug = [] [dependencies] winit = { version = "0.20.0-alpha3", git = "https://github.com/hecrj/winit", rev = "709808eb4e69044705fcb214bcc30556db761405"} log = "0.4" -futures = "0.3" [dependencies.iced_native] version = "0.1.0-alpha" path = "../native" -[dependencies.iced_futures] -version = "0.1.0-alpha" -path = "../futures" -features = ["thread-pool"] - [dependencies.window_clipboard] git = "https://github.com/hecrj/window_clipboard" rev = "22c6dd6c04cd05d528029b50a30c56417cd4bebf" diff --git a/winit/src/application.rs b/winit/src/application.rs index 076ac092..4b21a930 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -1,10 +1,9 @@ use crate::{ conversion, input::{keyboard, mouse}, - window, Cache, Clipboard, Command, Debug, Element, Event, Mode, - MouseCursor, Proxy, Settings, Size, Subscription, UserInterface, + window, Cache, Clipboard, Command, Debug, Element, Event, Executor, Mode, + MouseCursor, Proxy, Runtime, Settings, Size, Subscription, UserInterface, }; -use iced_native::Runtime; /// An interactive, native cross-platform application. /// @@ -20,6 +19,11 @@ pub trait Application: Sized { /// [`Application`]: trait.Application.html type Renderer: window::Renderer; + /// The [`Executor`] that will run commands and subscriptions. + /// + /// [`Executor`]: trait.Executor.html + type Executor: Executor; + /// The type of __messages__ your [`Application`] will produce. /// /// [`Application`]: trait.Application.html @@ -110,13 +114,13 @@ pub trait Application: Sized { debug.startup_started(); let event_loop = EventLoop::with_user_event(); + let mut external_messages = Vec::new(); + let mut runtime = { - let thread_pool = futures::executor::ThreadPool::new() - .expect("Create thread pool"); + let executor = Self::Executor::new().expect("Create executor"); - Runtime::new(thread_pool, Proxy::new(event_loop.create_proxy())) + Runtime::new(executor, Proxy::new(event_loop.create_proxy())) }; - let mut external_messages = Vec::new(); let (mut application, init_command) = Self::new(); runtime.spawn(init_command); diff --git a/winit/src/proxy.rs b/winit/src/proxy.rs index 7e8dee98..cff9df33 100644 --- a/winit/src/proxy.rs +++ b/winit/src/proxy.rs @@ -1,4 +1,4 @@ -use futures::{ +use iced_native::futures::{ task::{Context, Poll}, Sink, }; |