summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-01-21 00:15:01 +0100
committerLibravatar GitHub <noreply@github.com>2020-01-21 00:15:01 +0100
commit7016221556ea8183ebcd8ef8df00044e2eda71e7 (patch)
treebc1609b71b88437fc7497af339b6427f63121c76 /web
parent6ca5e6184f9f1c12b427bdafcce0b4e9fbc5bb14 (diff)
parent91d9d65a03ce9b211e4043726e7424949d314325 (diff)
downloadiced-7016221556ea8183ebcd8ef8df00044e2eda71e7.tar.gz
iced-7016221556ea8183ebcd8ef8df00044e2eda71e7.tar.bz2
iced-7016221556ea8183ebcd8ef8df00044e2eda71e7.zip
Merge pull request #164 from hecrj/feature/custom-runtime
Custom futures executor with `iced_futures`
Diffstat (limited to '')
-rw-r--r--web/Cargo.toml10
-rw-r--r--web/README.md2
-rw-r--r--web/src/lib.rs11
-rw-r--r--web/src/subscription.rs4
4 files changed, 19 insertions, 8 deletions
diff --git a/web/Cargo.toml b/web/Cargo.toml
index 605c7462..46953863 100644
--- a/web/Cargo.toml
+++ b/web/Cargo.toml
@@ -15,11 +15,17 @@ 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"
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
```
diff --git a/web/src/lib.rs b/web/src/lib.rs
index 7ea22e85..b1bb80e3 100644
--- a/web/src/lib.rs
+++ b/web/src/lib.rs
@@ -72,13 +72,19 @@ 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, Vector,
VerticalAlignment,
};
+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
@@ -148,7 +154,6 @@ pub trait Application {
}
}
-
struct Instance<Message> {
title: String,
ui: Rc<RefCell<Box<dyn Application<Message = Message>>>>,
@@ -167,7 +172,7 @@ impl<Message> Clone for Instance<Message> {
impl<Message> Instance<Message>
where
- Message: 'static
+ Message: 'static,
{
fn new(ui: impl Application<Message = Message> + '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<T> = iced_core::Subscription<Hasher, (), T>;
+pub type Subscription<T> = iced_futures::Subscription<Hasher, (), T>;
-pub use iced_core::subscription::Recipe;
+pub use iced_futures::subscription::Recipe;