Create iced_futures and wire everything up

This commit is contained in:
Héctor Ramón Jiménez 2020-01-19 10:17:08 +01:00
parent d50ff9b5d9
commit b5b17ed4d8
23 changed files with 196 additions and 195 deletions

View file

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

14
native/src/runtime.rs Normal file
View file

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

View file

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