Allow listening to runtime events in subscriptions

This commit is contained in:
Héctor Ramón Jiménez 2019-12-08 08:21:26 +01:00
parent 9b84b6e403
commit 98160406f7
7 changed files with 89 additions and 40 deletions

View file

@ -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"

View file

@ -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::*;

View file

@ -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;