Breaking change: upgrading to use Futures 0.3

This commit is contained in:
Pauan 2018-10-22 14:16:54 -10:00
parent 476902616d
commit 646075b74c
6 changed files with 281 additions and 205 deletions

230
Cargo.lock generated
View File

@ -13,11 +13,13 @@ name = "dominator"
version = "0.1.1"
dependencies = [
"discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-signals 0.1.0 (git+https://github.com/Pauan/rust-signals)",
"futures-util-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"stdweb 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-utils 0.1.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"stdweb 0.4.10 (git+https://github.com/koute/stdweb)",
"stdweb-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -27,62 +29,78 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "futures-channel"
version = "0.2.1"
name = "futures-channel-preview"
version = "0.3.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures-core"
version = "0.2.1"
name = "futures-core-preview"
version = "0.3.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures-io"
version = "0.2.1"
name = "futures-executor-preview"
version = "0.3.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-utils 0.1.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures-io-preview"
version = "0.3.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures-signals"
version = "0.1.0"
source = "git+https://github.com/Pauan/rust-signals#ab4e2b2eed60870748e1f5eb6b58015e8b0b884a"
source = "git+https://github.com/Pauan/rust-signals#a15860c48e18b7ec107a426a8022c0c3b0bddcce"
dependencies = [
"discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-utils 0.1.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures-sink"
version = "0.2.1"
name = "futures-sink-preview"
version = "0.3.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "futures-util"
version = "0.2.1"
name = "futures-util-preview"
version = "0.3.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-io 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-sink 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-io-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-sink-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"pin-utils 0.1.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -104,7 +122,7 @@ name = "lazy_static"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -112,9 +130,22 @@ name = "libc"
version = "0.2.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "num_cpus"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pin-utils"
version = "0.1.0-alpha.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "proc-macro2"
version = "0.4.19"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -125,7 +156,15 @@ name = "quote"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -133,45 +172,65 @@ name = "ryu"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "1.0.79"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_derive"
version = "1.0.79"
version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.4 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
version = "1.0.27"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "stdweb"
version = "0.4.9"
name = "slab"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "stdweb"
version = "0.4.10"
source = "git+https://github.com/koute/stdweb#ade7b00a95a20315385f350cc6fc19b96eccf357"
dependencies = [
"discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"stdweb-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"stdweb-internal-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"stdweb-internal-runtime 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-channel-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-executor-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-util-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
"stdweb-derive 0.5.1 (git+https://github.com/koute/stdweb)",
"stdweb-internal-macros 0.2.2 (git+https://github.com/koute/stdweb)",
"stdweb-internal-runtime 0.1.2 (git+https://github.com/koute/stdweb)",
]
[[package]]
@ -179,48 +238,61 @@ name = "stdweb-derive"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "stdweb-derive"
version = "0.5.1"
source = "git+https://github.com/koute/stdweb#ade7b00a95a20315385f350cc6fc19b96eccf357"
dependencies = [
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "stdweb-internal-macros"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
version = "0.2.2"
source = "git+https://github.com/koute/stdweb#ade7b00a95a20315385f350cc6fc19b96eccf357"
dependencies = [
"base-x 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "stdweb-internal-runtime"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
version = "0.1.2"
source = "git+https://github.com/koute/stdweb#ade7b00a95a20315385f350cc6fc19b96eccf357"
[[package]]
name = "syn"
version = "0.14.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "0.15.4"
version = "0.15.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -232,7 +304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "version_check"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -244,28 +316,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum base-x 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5cda5d0f5584d129112ad8bf4775b9fd2b9f1e30738c7b1a25314ba2244d6a51"
"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
"checksum futures-channel 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bbb37ec6418c577b25f5b129c0f4456ad7ce8714ec43c59712aa7e4cd2cb6b85"
"checksum futures-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7455c91eb2eae38f33b013f77ebe766c75761af333efd9d550e154045c63e225"
"checksum futures-io 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6a0470fdba9dc87c27a3564ad6d5cc04e080f3afa26c93549728cce46ab21a2"
"checksum futures-channel-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ab71b4d4948210b1ff4703e66cc9d931afd8ba35b5657cf369374a091cca96ed"
"checksum futures-core-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e5fea6d4920bf1745d87f8624abdd38ed03fb5b644767b84a0de882fe46c4153"
"checksum futures-executor-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)" = "43d4bb2cc4c0cefc554b0cf12f7151e0a578cf1820a36453eff1d955dde762ff"
"checksum futures-io-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)" = "91bd6aba63f52d532c0f4ca6e9960f80a1b4295c292362baf2cad6d739fa9123"
"checksum futures-signals 0.1.0 (git+https://github.com/Pauan/rust-signals)" = "<none>"
"checksum futures-sink 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a8a93a7c480876b8e02cdd70022e7eb9c8423575ea6a25a0b749b18834c16412"
"checksum futures-util 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cf12a3fc1ccaf1bc2901ec6e0ed6ed407a4f16eaa20dd838f40cabf5f7b31f1"
"checksum futures-sink-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)" = "cd7799480a224d80e9e915a6bf8bff27498e8210b831f5a513af09d5c1db2e36"
"checksum futures-util-preview 0.3.0-alpha.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b73a6f85964a8291914db0114ccb0045c994c58b2110c4cf4ac47f5d2176ec90"
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
"checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901"
"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
"checksum pin-utils 0.1.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42d42579e40cc2de14252a729e9727439657cf68a4997593aafe63728544ecb3"
"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee"
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7"
"checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9"
"checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe"
"checksum serde_json 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "59790990c5115d16027f00913e2e66de23a51f70422e549d2ad68c8c5f268f1c"
"checksum stdweb 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ee9aceb43e7711f862ab1adc2fcb0273213aa5ce34a11c7dcf629b899b69f550"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef"
"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c"
"checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce"
"checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d"
"checksum stdweb 0.4.10 (git+https://github.com/koute/stdweb)" = "<none>"
"checksum stdweb-derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "028bba8762f07e57b0ed00c9c4e893e032b00f0457d0febe60bd14f32c150609"
"checksum stdweb-internal-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a73e1d7bac65c0b52d2b38ef7b54c8873d579d9d37c571d615b93052fcd2eeff"
"checksum stdweb-internal-runtime 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e93e3ace205c4c1926b882cf8d8209e86acd445fda5fcf850455c3d178651c7"
"checksum stdweb-derive 0.5.1 (git+https://github.com/koute/stdweb)" = "<none>"
"checksum stdweb-internal-macros 0.2.2 (git+https://github.com/koute/stdweb)" = "<none>"
"checksum stdweb-internal-runtime 0.1.2 (git+https://github.com/koute/stdweb)" = "<none>"
"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
"checksum syn 0.15.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9056ebe7f2d6a38bc63171816fd1d3430da5a43896de21676dc5c0a4b8274a11"
"checksum syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4439ee8325b4e4b57e59309c3724c9a4478eaeb4eb094b6f3fac180a3b2876"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

View File

@ -14,8 +14,10 @@ categories = ["web-programming", "template-engine", "wasm"]
stdweb-derive = "0.5.0"
lazy_static = "1.0.0"
discard = "1.0.3"
futures-core = "0.2.0"
futures-channel = "0.2.1"
pin-utils = "0.1.0-alpha.3"
futures-core-preview = "0.3.0-alpha.7"
futures-channel-preview = "0.3.0-alpha.7"
futures-util-preview = "0.3.0-alpha.7"
#futures-signals = { path = "../rust-signals" }
futures-signals = { git = "https://github.com/Pauan/rust-signals" }

View File

@ -1,14 +1,16 @@
use std::fmt;
use std::pin::{Pin, Unpin};
use std::sync::{Arc, Weak, Mutex, RwLock};
use futures_core::Async;
use futures_core::future::Future;
use futures_core::task::{Context, Waker};
use futures_core::Poll;
use futures_core::task::{LocalWaker, Waker};
use futures_util::future::{ready, FutureExt};
use futures_signals::CancelableFutureHandle;
use futures_signals::signal::{Signal, SignalExt, WaitFor, MutableSignal, Mutable};
use futures_signals::signal_vec::{SignalVec, VecDiff};
use stdweb::Value;
use discard::DiscardOnDrop;
use operations::spawn_future;
use pin_utils::{unsafe_pinned, unsafe_unpinned};
// TODO generalize this so it works for any target, not just JS
@ -78,22 +80,22 @@ pub struct Timestamps {
impl Signal for Timestamps {
type Item = Option<f64>;
// TODO implement Async::Ready(None)
fn poll_change(&mut self, cx: &mut Context) -> Async<Option<Self::Item>> {
// TODO implement Poll::Ready(None)
fn poll_change(self: Pin<&mut Self>, waker: &LocalWaker) -> Poll<Option<Self::Item>> {
let mut lock = self.state.lock().unwrap();
match lock.state {
TimestampsEnum::Changed => {
lock.state = TimestampsEnum::NotChanged;
Async::Ready(Some(*self.value.read().unwrap()))
Poll::Ready(Some(*self.value.read().unwrap()))
},
TimestampsEnum::First => {
lock.state = TimestampsEnum::NotChanged;
Async::Ready(Some(None))
Poll::Ready(Some(None))
},
TimestampsEnum::NotChanged => {
lock.waker = Some(cx.waker().clone());
Async::Pending
lock.waker = Some(waker.clone().into_waker());
Poll::Pending
},
}
}
@ -215,6 +217,10 @@ impl<A, F, S> AnimatedMap<S, F>
where S: SignalVec,
F: FnMut(S::Item, AnimatedMapBroadcaster) -> A {
unsafe_unpinned!(animations: Vec<AnimatedMapState>);
unsafe_pinned!(signal: Option<S>);
unsafe_unpinned!(callback: F);
fn animated_state(&self) -> AnimatedMapState {
let state = AnimatedMapState {
animation: MutableAnimation::new(self.duration),
@ -226,25 +232,25 @@ impl<A, F, S> AnimatedMap<S, F>
state
}
fn remove_index(&mut self, index: usize) -> Async<Option<VecDiff<A>>> {
fn remove_index(self: &mut Pin<&mut Self>, index: usize) -> Poll<Option<VecDiff<A>>> {
if index == (self.animations.len() - 1) {
self.animations.pop();
Async::Ready(Some(VecDiff::Pop {}))
self.animations().pop();
Poll::Ready(Some(VecDiff::Pop {}))
} else {
self.animations.remove(index);
Async::Ready(Some(VecDiff::RemoveAt { index }))
self.animations().remove(index);
Poll::Ready(Some(VecDiff::RemoveAt { index }))
}
}
fn should_remove(&mut self, cx: &mut Context, index: usize) -> bool {
let state = &mut self.animations[index];
fn should_remove(self: &mut Pin<&mut Self>, waker: &LocalWaker, index: usize) -> bool {
let state = &mut self.animations()[index];
state.animation.animate_to(Percentage::new_unchecked(0.0));
let mut future = state.animation.signal().wait_for(Percentage::new_unchecked(0.0));
if future.poll(cx).unwrap().is_ready() {
if future.poll_unpin(waker).is_ready() {
true
} else {
@ -279,33 +285,35 @@ impl<A, F, S> AnimatedMap<S, F>
}
}
impl<A, B> Unpin for AnimatedMap<A, B> where A: Unpin {}
impl<A, F, S> SignalVec for AnimatedMap<S, F>
where S: SignalVec,
F: FnMut(S::Item, AnimatedMapBroadcaster) -> A {
type Item = A;
// TODO this can probably be implemented more efficiently
fn poll_vec_change(&mut self, cx: &mut Context) -> Async<Option<VecDiff<Self::Item>>> {
fn poll_vec_change(mut self: Pin<&mut Self>, waker: &LocalWaker) -> Poll<Option<VecDiff<Self::Item>>> {
let mut is_done = true;
// TODO is this loop correct ?
while let Some(result) = self.signal.as_mut().map(|signal| signal.poll_vec_change(cx)) {
while let Some(result) = self.signal().as_pin_mut().map(|signal| signal.poll_vec_change(waker)) {
match result {
Async::Ready(Some(change)) => return match change {
Poll::Ready(Some(change)) => return match change {
// TODO maybe it should play remove / insert animations for this ?
VecDiff::Replace { values } => {
self.animations = Vec::with_capacity(values.len());
*self.animations() = Vec::with_capacity(values.len());
Async::Ready(Some(VecDiff::Replace {
Poll::Ready(Some(VecDiff::Replace {
values: values.into_iter().map(|value| {
let state = AnimatedMapState {
animation: MutableAnimation::new_with_initial(self.duration, Percentage::new_unchecked(1.0)),
removing: None,
};
let value = (self.callback)(value, AnimatedMapBroadcaster(state.animation.raw_clone()));
let value = self.callback()(value, AnimatedMapBroadcaster(state.animation.raw_clone()));
self.animations.push(state);
self.animations().push(state);
value
}).collect()
@ -315,23 +323,26 @@ impl<A, F, S> SignalVec for AnimatedMap<S, F>
VecDiff::InsertAt { index, value } => {
let index = self.find_index(index).unwrap_or_else(|| self.animations.len());
let state = self.animated_state();
let value = (self.callback)(value, AnimatedMapBroadcaster(state.animation.raw_clone()));
self.animations.insert(index, state);
Async::Ready(Some(VecDiff::InsertAt { index, value }))
let value = self.callback()(value, AnimatedMapBroadcaster(state.animation.raw_clone()));
self.animations().insert(index, state);
Poll::Ready(Some(VecDiff::InsertAt { index, value }))
},
VecDiff::Push { value } => {
let state = self.animated_state();
let value = (self.callback)(value, AnimatedMapBroadcaster(state.animation.raw_clone()));
self.animations.push(state);
Async::Ready(Some(VecDiff::Push { value }))
let value = self.callback()(value, AnimatedMapBroadcaster(state.animation.raw_clone()));
self.animations().push(state);
Poll::Ready(Some(VecDiff::Push { value }))
},
VecDiff::UpdateAt { index, value } => {
let index = self.find_index(index).expect("Could not find value");
let state = &self.animations[index];
let value = (self.callback)(value, AnimatedMapBroadcaster(state.animation.raw_clone()));
Async::Ready(Some(VecDiff::UpdateAt { index, value }))
let state = {
let state = &self.animations()[index];
AnimatedMapBroadcaster(state.animation.raw_clone())
};
let value = self.callback()(value, state);
Poll::Ready(Some(VecDiff::UpdateAt { index, value }))
},
// TODO test this
@ -339,19 +350,19 @@ impl<A, F, S> SignalVec for AnimatedMap<S, F>
VecDiff::Move { old_index, new_index } => {
let old_index = self.find_index(old_index).expect("Could not find value");
let state = self.animations.remove(old_index);
let state = self.animations().remove(old_index);
let new_index = self.find_index(new_index).unwrap_or_else(|| self.animations.len());
self.animations.insert(new_index, state);
self.animations().insert(new_index, state);
Async::Ready(Some(VecDiff::Move { old_index, new_index }))
Poll::Ready(Some(VecDiff::Move { old_index, new_index }))
},
VecDiff::RemoveAt { index } => {
let index = self.find_index(index).expect("Could not find value");
if self.should_remove(cx, index) {
if self.should_remove(waker, index) {
self.remove_index(index)
} else {
@ -362,7 +373,7 @@ impl<A, F, S> SignalVec for AnimatedMap<S, F>
VecDiff::Pop {} => {
let index = self.find_last_index().expect("Cannot pop from empty vec");
if self.should_remove(cx, index) {
if self.should_remove(waker, index) {
self.remove_index(index)
} else {
@ -372,15 +383,15 @@ impl<A, F, S> SignalVec for AnimatedMap<S, F>
// TODO maybe it should play remove animation for this ?
VecDiff::Clear {} => {
self.animations.clear();
Async::Ready(Some(VecDiff::Clear {}))
self.animations().clear();
Poll::Ready(Some(VecDiff::Clear {}))
},
},
Async::Ready(None) => {
self.signal = None;
Poll::Ready(None) => {
Pin::set(self.signal(), None);
break;
},
Async::Pending => {
Poll::Pending => {
is_done = false;
break;
},
@ -391,10 +402,10 @@ impl<A, F, S> SignalVec for AnimatedMap<S, F>
// TODO make this more efficient (e.g. using a similar strategy as FuturesUnordered)
// This uses rposition so that way it will return VecDiff::Pop in more situations
let index = self.animations.iter_mut().rposition(|state| {
let index = self.animations().iter_mut().rposition(|state| {
if let Some(ref mut future) = state.removing {
is_removing = true;
future.poll(cx).unwrap().is_ready()
future.poll_unpin(waker).is_ready()
} else {
false
@ -406,10 +417,10 @@ impl<A, F, S> SignalVec for AnimatedMap<S, F>
self.remove_index(index)
},
None => if is_done && !is_removing {
Async::Ready(None)
Poll::Ready(None)
} else {
Async::Pending
Poll::Pending
},
}
}
@ -521,7 +532,7 @@ impl OnTimestampDiff {
callback(current_time - starting_time);
}
Ok(())
ready(())
})
))
}
@ -541,8 +552,8 @@ impl Signal for MutableAnimationSignal {
type Item = Percentage;
#[inline]
fn poll_change(&mut self, cx: &mut Context) -> Async<Option<Self::Item>> {
self.0.poll_change(cx)
fn poll_change(mut self: Pin<&mut Self>, waker: &LocalWaker) -> Poll<Option<Self::Item>> {
self.0.poll_change_unpin(waker)
}
}

View File

@ -1,3 +1,4 @@
use std::pin::Pin;
use std::convert::AsRef;
use std::marker::PhantomData;
use stdweb::{Reference, Value, JsSerialize, Once};
@ -10,11 +11,12 @@ use operations;
use operations::for_each;
use dom_operations;
use operations::{ValueDiscard, FnDiscard, spawn_future};
use futures_signals::signal::{IntoSignal, Signal};
use futures_signals::signal_vec::IntoSignalVec;
use futures_core::{Never, Async};
use futures_core::task::Context;
use futures_signals::signal::Signal;
use futures_signals::signal_vec::SignalVec;
use futures_core::Poll;
use futures_core::task::LocalWaker;
use futures_core::future::Future;
use futures_util::FutureExt;
use futures_channel::oneshot;
use discard::{Discard, DiscardOnDrop};
@ -173,18 +175,22 @@ enum IsWindowLoaded {
impl Signal for IsWindowLoaded {
type Item = bool;
fn poll_change(&mut self, cx: &mut Context) -> Async<Option<Self::Item>> {
let result = match self {
fn poll_change(self: Pin<&mut Self>, waker: &LocalWaker) -> Poll<Option<Self::Item>> {
// Safe to call `get_mut_unchecked` because we won't move the futures.
// TODO verify the safety of this
let this = unsafe { Pin::get_mut_unchecked(self) };
let result = match this {
IsWindowLoaded::Initial {} => {
let is_ready: bool = js!( return document.readyState === "complete"; ).try_into().unwrap();
if is_ready {
Async::Ready(Some(true))
Poll::Ready(Some(true))
} else {
let (sender, receiver) = oneshot::channel();
*self = IsWindowLoaded::Pending {
*this = IsWindowLoaded::Pending {
receiver,
event: IsWindowLoadedEvent::new(move || {
// TODO test this
@ -192,19 +198,19 @@ impl Signal for IsWindowLoaded {
}),
};
Async::Ready(Some(false))
Poll::Ready(Some(false))
}
},
IsWindowLoaded::Pending { receiver, .. } => {
receiver.poll(cx).unwrap().map(|_| Some(true))
receiver.poll_unpin(waker).map(|_| Some(true))
},
IsWindowLoaded::Done {} => {
Async::Ready(None)
Poll::Ready(None)
},
};
if let Async::Ready(Some(true)) = result {
*self = IsWindowLoaded::Done {};
if let Poll::Ready(Some(true)) = result {
*this = IsWindowLoaded::Done {};
}
result
@ -226,8 +232,7 @@ pub fn text(value: &str) -> Dom {
// TODO should this inline ?
pub fn text_signal<A, B>(value: B) -> Dom
where A: AsStr,
B: IntoSignal<Item = A>,
B::Signal: 'static {
B: Signal<Item = A> + 'static {
let element: TextNode = js!( return document.createTextNode(""); ).try_into().unwrap();
@ -236,7 +241,7 @@ pub fn text_signal<A, B>(value: B) -> Dom
{
let element = element.clone();
callbacks.after_remove(for_each(value.into_signal(), move |value| {
callbacks.after_remove(for_each(value, move |value| {
let value = value.as_str();
dom_operations::set_text(&element, value);
}));
@ -313,15 +318,14 @@ pub fn create_element_ns<A: IElement>(name: &str, namespace: &str) -> A
fn set_option<A, B, C, D, F>(element: &A, callbacks: &mut Callbacks, value: D, mut f: F)
where A: Clone + 'static,
C: OptionStr<Output = B>,
D: IntoSignal<Item = C>,
D::Signal: 'static,
D: Signal<Item = C> + 'static,
F: FnMut(&A, Option<B>) + 'static {
let element = element.clone();
let mut is_set = false;
callbacks.after_remove(for_each(value.into_signal(), move |value| {
callbacks.after_remove(for_each(value, move |value| {
let value = value.into_option();
if value.is_some() {
@ -370,8 +374,7 @@ fn set_style_signal<A, B, C, D, E>(element: &A, callbacks: &mut Callbacks, name:
B: MultiStr + 'static,
C: MultiStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
set_option(element, callbacks, value, move |element, value| {
match value {
@ -435,7 +438,7 @@ impl<A> DomBuilder<A> {
}
#[inline]
pub fn future<F>(mut self, future: F) -> Self where F: Future<Item = (), Error = Never> + 'static {
pub fn future<F>(mut self, future: F) -> Self where F: Future<Output = ()> + 'static {
self.callbacks.after_remove(DiscardOnDrop::leak(spawn_future(future)));
self
}
@ -502,12 +505,11 @@ impl<A: AsRef<Reference> + Clone + 'static> DomBuilder<A> {
fn set_property_signal<B, C, D>(&mut self, name: B, value: D)
where B: MultiStr + 'static,
C: JsSerialize,
D: IntoSignal<Item = C>,
D::Signal: 'static {
D: Signal<Item = C> + 'static {
let element = self.element.clone();
self.callbacks.after_remove(for_each(value.into_signal(), move |value| {
self.callbacks.after_remove(for_each(value, move |value| {
name.each(|name| {
dom_operations::set_property(&element, name, &value);
});
@ -518,8 +520,7 @@ impl<A: AsRef<Reference> + Clone + 'static> DomBuilder<A> {
pub fn property_signal<B, C, D>(mut self, name: B, value: D) -> Self
where B: MultiStr + 'static,
C: JsSerialize,
D: IntoSignal<Item = C>,
D::Signal: 'static {
D: Signal<Item = C> + 'static {
self.set_property_signal(name, value);
self
@ -553,8 +554,7 @@ impl<A: INode> DomBuilder<A> {
impl<A: INode + Clone + 'static> DomBuilder<A> {
#[inline]
pub fn children_signal_vec<B>(mut self, children: B) -> Self
where B: IntoSignalVec<Item = Dom>,
B::SignalVec: 'static {
where B: SignalVec<Item = Dom> + 'static {
assert_eq!(self.has_children, false);
self.has_children = true;
@ -595,8 +595,7 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
set_option(&self.element, &mut self.callbacks, value, move |element, value| {
match value {
@ -622,8 +621,7 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
self.set_attribute_signal(name, value);
self
@ -633,8 +631,7 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
let namespace = namespace.to_owned();
@ -661,8 +658,7 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
where B: MultiStr + 'static,
C: AsStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
self.set_attribute_namespace_signal(namespace, name, value);
self
@ -671,14 +667,13 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
fn set_class_signal<B, C>(&mut self, name: B, value: C)
where B: MultiStr + 'static,
C: IntoSignal<Item = bool>,
C::Signal: 'static {
C: Signal<Item = bool> + 'static {
let element = self.element.clone();
let mut is_set = false;
self.callbacks.after_remove(for_each(value.into_signal(), move |value| {
self.callbacks.after_remove(for_each(value, move |value| {
if value {
if !is_set {
is_set = true;
@ -703,8 +698,7 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
#[inline]
pub fn class_signal<B, C>(mut self, name: B, value: C) -> Self
where B: MultiStr + 'static,
C: IntoSignal<Item = bool>,
C::Signal: 'static {
C: Signal<Item = bool> + 'static {
self.set_class_signal(name, value);
self
@ -713,14 +707,11 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
// TODO use OptionStr ?
fn set_scroll_signal<B, F>(&mut self, signal: B, mut f: F)
where B: IntoSignal<Item = Option<f64>>,
B::Signal: 'static,
where B: Signal<Item = Option<f64>> + 'static,
F: FnMut(&A, f64) + 'static {
let element = self.element.clone();
let signal = signal.into_signal();
// This needs to use `after_insert` because scrolling an element before it is in the DOM has no effect
self.callbacks.after_insert(move |callbacks| {
callbacks.after_remove(for_each(signal, move |value| {
@ -732,13 +723,13 @@ impl<A: IElement + Clone + 'static> DomBuilder<A> {
}
#[inline]
pub fn scroll_left_signal<B>(mut self, signal: B) -> Self where B: IntoSignal<Item = Option<f64>>, B::Signal: 'static {
pub fn scroll_left_signal<B>(mut self, signal: B) -> Self where B: Signal<Item = Option<f64>> + 'static {
self.set_scroll_signal(signal, IElement::set_scroll_left);
self
}
#[inline]
pub fn scroll_top_signal<B>(mut self, signal: B) -> Self where B: IntoSignal<Item = Option<f64>>, B::Signal: 'static {
pub fn scroll_top_signal<B>(mut self, signal: B) -> Self where B: Signal<Item = Option<f64>> + 'static {
self.set_scroll_signal(signal, IElement::set_scroll_top);
self
}
@ -768,8 +759,7 @@ impl<A: IHtmlElement + Clone + 'static> DomBuilder<A> {
where B: MultiStr + 'static,
C: MultiStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
set_style_signal(&self.element, &mut self.callbacks, name, value, false);
self
@ -780,8 +770,7 @@ impl<A: IHtmlElement + Clone + 'static> DomBuilder<A> {
where B: MultiStr + 'static,
C: MultiStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
set_style_signal(&self.element, &mut self.callbacks, name, value, true);
self
@ -804,13 +793,10 @@ impl<A: IHtmlElement + Clone + 'static> DomBuilder<A> {
fn set_focused_signal<B>(&mut self, value: B)
where B: IntoSignal<Item = bool>,
B::Signal: 'static {
where B: Signal<Item = bool> + 'static {
let element = self.element.clone();
let value = value.into_signal();
// This needs to use `after_insert` because calling `.focus()` on an element before it is in the DOM has no effect
self.callbacks.after_insert(move |callbacks| {
// TODO verify that this is correct under all circumstances
@ -823,8 +809,7 @@ impl<A: IHtmlElement + Clone + 'static> DomBuilder<A> {
#[inline]
pub fn focused_signal<B>(mut self, value: B) -> Self
where B: IntoSignal<Item = bool>,
B::Signal: 'static {
where B: Signal<Item = bool> + 'static {
self.set_focused_signal(value);
self
@ -886,8 +871,7 @@ impl StylesheetBuilder {
where B: MultiStr + 'static,
C: MultiStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
set_style_signal(&self.element, &mut self.callbacks, name, value, false);
self
@ -898,8 +882,7 @@ impl StylesheetBuilder {
where B: MultiStr + 'static,
C: MultiStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
set_style_signal(&self.element, &mut self.callbacks, name, value, true);
self
@ -971,8 +954,7 @@ impl ClassBuilder {
where B: MultiStr + 'static,
C: MultiStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
self.stylesheet = self.stylesheet.style_signal(name, value);
self
@ -983,8 +965,7 @@ impl ClassBuilder {
where B: MultiStr + 'static,
C: MultiStr,
D: OptionStr<Output = C>,
E: IntoSignal<Item = D>,
E::Signal: 'static {
E: Signal<Item = D> + 'static {
self.stylesheet = self.stylesheet.style_important_signal(name, value);
self

View File

@ -1,4 +1,5 @@
#![recursion_limit="128"]
#![feature(futures_api, pin, arbitrary_self_types)]
#![warn(unreachable_pub)]
#[macro_use]
@ -13,7 +14,9 @@ extern crate lazy_static;
extern crate discard;
extern crate futures_core;
extern crate futures_channel;
extern crate futures_util;
extern crate futures_signals;
extern crate pin_utils;
mod macros;

View File

@ -1,27 +1,27 @@
use std::sync::{Arc, Mutex};
use std::mem::ManuallyDrop;
use stdweb::PromiseFuture;
use discard::{Discard, DiscardOnDrop};
use futures_core::future::Future;
use futures_util::future::ready;
use futures_signals::{cancelable_future, CancelableFutureHandle};
use futures_signals::signal::{Signal, SignalExt};
use futures_signals::signal_vec::{VecDiff, SignalVec, SignalVecExt, IntoSignalVec};
use futures_signals::signal_vec::{VecDiff, SignalVec, SignalVecExt};
use dom_operations;
use dom::Dom;
use callbacks::Callbacks;
use std::iter::IntoIterator;
use stdweb::spawn_local;
use stdweb::traits::INode;
use futures_core::Never;
use futures_core::future::Future;
// TODO this should probably be in stdweb
#[inline]
pub(crate) fn spawn_future<F>(future: F) -> DiscardOnDrop<CancelableFutureHandle>
where F: Future<Item = (), Error = Never> + 'static {
where F: Future<Output = ()> + 'static {
// TODO make this more efficient ?
let (handle, future) = cancelable_future(future, |_| ());
let (handle, future) = cancelable_future(future, || ());
PromiseFuture::spawn_local(future);
spawn_local(future);
handle
}
@ -34,7 +34,7 @@ pub(crate) fn for_each<A, B>(signal: A, mut callback: B) -> CancelableFutureHand
DiscardOnDrop::leak(spawn_future(signal.for_each(move |value| {
callback(value);
Ok(())
ready(())
})))
}
@ -46,7 +46,7 @@ fn for_each_vec<A, B>(signal: A, mut callback: B) -> CancelableFutureHandle
DiscardOnDrop::leak(spawn_future(signal.for_each(move |value| {
callback(value);
Ok(())
ready(())
})))
}
@ -131,8 +131,7 @@ impl<A> Discard for FnDiscard<A> where A: FnOnce() {
pub(crate) fn insert_children_signal_vec<A, B>(element: &A, callbacks: &mut Callbacks, signal: B)
where A: INode + Clone + 'static,
B: IntoSignalVec<Item = Dom>,
B::SignalVec: 'static {
B: SignalVec<Item = Dom> + 'static {
let element = element.clone();
@ -165,7 +164,7 @@ pub(crate) fn insert_children_signal_vec<A, B>(element: &A, callbacks: &mut Call
}
// TODO verify that this will drop `children`
callbacks.after_remove(for_each_vec(signal.into_signal_vec(), move |change| {
callbacks.after_remove(for_each_vec(signal, move |change| {
let mut state = state.lock().unwrap();
match change {