From b5b17ed4d800c03beb3ad535d1069a7784e8dc1d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 19 Jan 2020 10:17:08 +0100 Subject: Create `iced_futures` and wire everything up --- web/Cargo.toml | 9 ++++++++- web/src/lib.rs | 6 +++--- web/src/subscription.rs | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'web') diff --git a/web/Cargo.toml b/web/Cargo.toml index 605c7462..ea092575 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -15,12 +15,19 @@ categories = ["web-programming"] maintenance = { status = "actively-developed" } [dependencies] -iced_core = { version = "0.1.0", path = "../core", features = ["command", "subscription"] } dodrio = "0.1.0" wasm-bindgen = "0.2.51" wasm-bindgen-futures = "0.4" futures = "0.3" +[dependencies.iced_core] +version = "0.1.0" +path = "../core" + +[dependencies.iced_futures] +version = "0.1.0-alpha" +path = "../futures" + [dependencies.web-sys] version = "0.3.27" features = [ diff --git a/web/src/lib.rs b/web/src/lib.rs index 7ea22e85..b183c390 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -72,9 +72,10 @@ pub use dodrio; pub use element::Element; pub use hasher::Hasher; pub use iced_core::{ - Align, Background, Color, Command, Font, HorizontalAlignment, Length, + Align, Background, Color, Font, HorizontalAlignment, Length, VerticalAlignment, }; +pub use iced_futures::Command; pub use style::Style; pub use subscription::Subscription; pub use widget::*; @@ -148,7 +149,6 @@ pub trait Application { } } - struct Instance { title: String, ui: Rc>>>, @@ -167,7 +167,7 @@ impl Clone for Instance { impl Instance where - Message: 'static + Message: 'static, { fn new(ui: impl Application + 'static) -> Self { Self { diff --git a/web/src/subscription.rs b/web/src/subscription.rs index 4638c8ab..6b8415c0 100644 --- a/web/src/subscription.rs +++ b/web/src/subscription.rs @@ -14,6 +14,6 @@ use crate::Hasher; /// /// [`Command`]: ../struct.Command.html /// [`Subscription`]: struct.Subscription.html -pub type Subscription = iced_core::Subscription; +pub type Subscription = iced_futures::Subscription; -pub use iced_core::subscription::Recipe; +pub use iced_futures::subscription::Recipe; -- cgit From 90690702e1e4abab804ec91e8ff4183824bec436 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 20 Jan 2020 04:47:36 +0100 Subject: Add `Application::Executor` associated type --- web/Cargo.toml | 1 - web/src/lib.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'web') diff --git a/web/Cargo.toml b/web/Cargo.toml index ea092575..46953863 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -18,7 +18,6 @@ maintenance = { status = "actively-developed" } dodrio = "0.1.0" wasm-bindgen = "0.2.51" wasm-bindgen-futures = "0.4" -futures = "0.3" [dependencies.iced_core] version = "0.1.0" diff --git a/web/src/lib.rs b/web/src/lib.rs index b183c390..c44b99b5 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -75,7 +75,7 @@ pub use iced_core::{ Align, Background, Color, Font, HorizontalAlignment, Length, VerticalAlignment, }; -pub use iced_futures::Command; +pub use iced_futures::{futures, Command}; pub use style::Style; pub use subscription::Subscription; pub use widget::*; -- cgit From 04086a90c9e933ebfb42de378054e1115b33529d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 20 Jan 2020 05:43:09 +0100 Subject: Implement `WasmBindgen` executor and reorganize --- web/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/src/lib.rs b/web/src/lib.rs index c44b99b5..b1bb80e3 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -72,14 +72,19 @@ pub use dodrio; pub use element::Element; pub use hasher::Hasher; pub use iced_core::{ - Align, Background, Color, Font, HorizontalAlignment, Length, + Align, Background, Color, Font, HorizontalAlignment, Length, Vector, VerticalAlignment, }; -pub use iced_futures::{futures, Command}; +pub use iced_futures::{executor, futures, Command}; pub use style::Style; pub use subscription::Subscription; + +#[doc(no_inline)] pub use widget::*; +#[doc(no_inline)] +pub use executor::Executor; + /// An interactive web application. /// /// This trait is the main entrypoint of Iced. Once implemented, you can run -- cgit From e2ec092aeca64a8107070d72c42c5805dc2c245b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 20 Jan 2020 06:40:20 +0100 Subject: Add `README` for `tour` example --- web/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web') diff --git a/web/README.md b/web/README.md index 6a3da7b4..cfd73320 100644 --- a/web/README.md +++ b/web/README.md @@ -35,7 +35,7 @@ For instance, let's say we want to build the [`tour` example]: ``` cd examples -cargo build --example tour --target wasm32-unknown-unknown +cargo build --package tour --target wasm32-unknown-unknown wasm-bindgen ../target/wasm32-unknown-unknown/debug/examples/tour.wasm --out-dir tour --web ``` -- cgit