diff options
author | 2020-01-19 10:17:08 +0100 | |
---|---|---|
committer | 2020-01-19 10:17:44 +0100 | |
commit | b5b17ed4d800c03beb3ad535d1069a7784e8dc1d (patch) | |
tree | b9e6477bd11bd6784f8ee61e818b5f5ff1a44318 /native | |
parent | d50ff9b5d97d9c3d6c6c70a9b4efe764b6126c86 (diff) | |
download | iced-b5b17ed4d800c03beb3ad535d1069a7784e8dc1d.tar.gz iced-b5b17ed4d800c03beb3ad535d1069a7784e8dc1d.tar.bz2 iced-b5b17ed4d800c03beb3ad535d1069a7784e8dc1d.zip |
Create `iced_futures` and wire everything up
Diffstat (limited to '')
-rw-r--r-- | native/Cargo.toml | 9 | ||||
-rw-r--r-- | native/src/lib.rs | 7 | ||||
-rw-r--r-- | native/src/runtime.rs | 14 | ||||
-rw-r--r-- | native/src/subscription.rs | 6 |
4 files changed, 30 insertions, 6 deletions
diff --git a/native/Cargo.toml b/native/Cargo.toml index a31b6627..57a869e2 100644 --- a/native/Cargo.toml +++ b/native/Cargo.toml @@ -8,8 +8,15 @@ license = "MIT" repository = "https://github.com/hecrj/iced" [dependencies] -iced_core = { version = "0.1.0", path = "../core", features = ["command", "subscription"] } twox-hash = "1.5" raw-window-handle = "0.3" unicode-segmentation = "1.6" futures = "0.3" + +[dependencies.iced_core] +version = "0.1.0" +path = "../core" + +[dependencies.iced_futures] +version = "0.1.0-alpha" +path = "../futures" diff --git a/native/src/lib.rs b/native/src/lib.rs index 340b9ea7..7730c6a3 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -42,6 +42,7 @@ pub mod input; pub mod layout; pub mod renderer; +pub mod runtime; pub mod subscription; pub mod widget; pub mod window; @@ -55,9 +56,10 @@ mod size; mod user_interface; pub use iced_core::{ - Align, Background, Color, Command, Font, HorizontalAlignment, Length, - Point, Rectangle, Vector, VerticalAlignment, + Align, Background, Color, Font, HorizontalAlignment, Length, Point, + Rectangle, Vector, VerticalAlignment, }; +pub use iced_futures::Command; pub use clipboard::Clipboard; pub use element::Element; @@ -66,6 +68,7 @@ pub use hasher::Hasher; pub use layout::Layout; pub use mouse_cursor::MouseCursor; pub use renderer::Renderer; +pub use runtime::Runtime; pub use size::Size; pub use subscription::Subscription; pub use user_interface::{Cache, UserInterface}; diff --git a/native/src/runtime.rs b/native/src/runtime.rs new file mode 100644 index 00000000..2b3abbf1 --- /dev/null +++ b/native/src/runtime.rs @@ -0,0 +1,14 @@ +//! Run commands and subscriptions. +use crate::{Event, Hasher}; + +/// A native runtime with a generic executor and receiver of results. +/// +/// It can be used by shells to easily spawn a [`Command`] or track a +/// [`Subscription`]. +/// +/// [`Command`]: ../struct.Command.html +/// [`Subscription`]: ../struct.Subscription.html +pub type Runtime<Executor, Receiver, Message> = + iced_futures::Runtime<Hasher, Event, Executor, Receiver, Message>; + +pub use iced_futures::runtime::Executor; diff --git a/native/src/subscription.rs b/native/src/subscription.rs index cd0822c1..43f1758a 100644 --- a/native/src/subscription.rs +++ b/native/src/subscription.rs @@ -15,7 +15,7 @@ use futures::stream::BoxStream; /// /// [`Command`]: ../struct.Command.html /// [`Subscription`]: struct.Subscription.html -pub type Subscription<T> = iced_core::Subscription<Hasher, Event, T>; +pub type Subscription<T> = iced_futures::Subscription<Hasher, Event, T>; /// A stream of runtime events. /// @@ -27,9 +27,9 @@ pub type EventStream = BoxStream<'static, Event>; /// A native [`Subscription`] tracker. /// /// [`Subscription`]: type.Subscription.html -pub type Tracker = iced_core::subscription::Tracker<Hasher, Event>; +pub type Tracker = iced_futures::subscription::Tracker<Hasher, Event>; -pub use iced_core::subscription::Recipe; +pub use iced_futures::subscription::Recipe; mod events; |