diff options
author | 2019-12-08 08:21:26 +0100 | |
---|---|---|
committer | 2019-12-08 08:21:26 +0100 | |
commit | 98160406f714728afe718f305bf9d12be1676b2d (patch) | |
tree | bf8fec3cb66bc478a021aba156d6be580586616e /native | |
parent | 9b84b6e40336543380312aa1b2b1091791ec25cd (diff) | |
download | iced-98160406f714728afe718f305bf9d12be1676b2d.tar.gz iced-98160406f714728afe718f305bf9d12be1676b2d.tar.bz2 iced-98160406f714728afe718f305bf9d12be1676b2d.zip |
Allow listening to runtime events in subscriptions
Diffstat (limited to '')
-rw-r--r-- | native/Cargo.toml | 1 | ||||
-rw-r--r-- | native/src/lib.rs | 8 | ||||
-rw-r--r-- | native/src/subscription.rs | 6 |
3 files changed, 12 insertions, 3 deletions
diff --git a/native/Cargo.toml b/native/Cargo.toml index 7007855a..a31b6627 100644 --- a/native/Cargo.toml +++ b/native/Cargo.toml @@ -12,3 +12,4 @@ iced_core = { version = "0.1.0", path = "../core", features = ["command", "subsc twox-hash = "1.5" raw-window-handle = "0.3" unicode-segmentation = "1.6" +futures = "0.3" diff --git a/native/src/lib.rs b/native/src/lib.rs index 9afb3bc9..af937a2f 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -34,7 +34,7 @@ //! [`Windowed`]: renderer/trait.Windowed.html //! [`UserInterface`]: struct.UserInterface.html //! [renderer]: renderer/index.html -#![deny(missing_docs)] +//#![deny(missing_docs)] #![deny(missing_debug_implementations)] #![deny(unused_results)] #![deny(unsafe_code)] @@ -42,6 +42,7 @@ pub mod input; pub mod layout; pub mod renderer; +pub mod subscription; pub mod widget; mod element; @@ -52,8 +53,8 @@ mod size; mod user_interface; pub use iced_core::{ - subscription, Align, Background, Color, Command, Font, HorizontalAlignment, - Length, Point, Rectangle, Subscription, Vector, VerticalAlignment, + Align, Background, Color, Command, Font, HorizontalAlignment, Length, + Point, Rectangle, Vector, VerticalAlignment, }; pub use element::Element; @@ -63,5 +64,6 @@ pub use layout::Layout; pub use mouse_cursor::MouseCursor; pub use renderer::Renderer; pub use size::Size; +pub use subscription::Subscription; pub use user_interface::{Cache, UserInterface}; pub use widget::*; diff --git a/native/src/subscription.rs b/native/src/subscription.rs new file mode 100644 index 00000000..5fa026a2 --- /dev/null +++ b/native/src/subscription.rs @@ -0,0 +1,6 @@ +use crate::Event; + +pub type Subscription<T> = iced_core::Subscription<Input, T>; +pub type Input = futures::channel::mpsc::Receiver<Event>; + +pub use iced_core::subscription::Connection; |