From 98160406f714728afe718f305bf9d12be1676b2d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 8 Dec 2019 08:21:26 +0100 Subject: Allow listening to runtime events in subscriptions --- native/Cargo.toml | 1 + native/src/lib.rs | 8 +++++--- native/src/subscription.rs | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 native/src/subscription.rs (limited to 'native') 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 = iced_core::Subscription; +pub type Input = futures::channel::mpsc::Receiver; + +pub use iced_core::subscription::Connection; -- cgit