diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f3dfa033..4ecb9f846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # Changelog ## v0.3.4 -- The `update` fn now returns `impl vdom::Updater`, allowing more concise syntax. Non-breaking. +- The `update` fn now accepts a (new) `Orders` struct, and returns nothing. Renders occur implicitly, +with the option to skip rendering, update with an additional message, or perform an asynchronous +action. (Breaking) - `.mount()` now accepts elements. Deprecated `.mount_el()` - The `log` function and macro now support items which implement `Debug` - Removed deprecated `routing::push_path` function (breaking) diff --git a/Cargo.lock b/Cargo.lock index 61c8a3581..f7a91d026 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,17 +79,6 @@ name = "cfg-if" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "chrono" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -351,19 +340,6 @@ dependencies = [ "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "num-integer" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "orders" version = "0.1.0" @@ -562,22 +538,6 @@ name = "scoped-tls" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "seed" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", - "pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-futures 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "seed" version = "0.3.4" @@ -635,19 +595,6 @@ dependencies = [ "web-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "server-interaction-detailed" -version = "0.1.0" -dependencies = [ - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "seed 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sha1" version = "0.6.0" @@ -715,16 +662,6 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "time" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "todomvc" version = "0.1.0" @@ -1027,7 +964,6 @@ dependencies = [ "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83" "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" -"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211" "checksum enclose 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3b762b80547dcf67e427c99ab25dd421fe7d95938c1b10763824555b73b09c7c" @@ -1058,8 +994,6 @@ dependencies = [ "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15" @@ -1083,7 +1017,6 @@ dependencies = [ "checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" -"checksum seed 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c34294be5cdaa620c13ea87e6a71e2f0e031ac6e22b5decf5410cd32c9f8414d" "checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" "checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" @@ -1096,7 +1029,6 @@ dependencies = [ "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" diff --git a/Cargo.toml b/Cargo.toml index 180dd7b54..d17f3cda4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ members = [ "examples/orders", # "examples/server_integration", # has own workspace "examples/server_interaction", - "examples/server_interaction_detailed", +# "examples/server_interaction_detailed", # has own workspace "examples/todomvc", "examples/update_from_js", "examples/websocket", @@ -92,4 +92,5 @@ members = [ exclude = [ # it has own workspace "examples/server_integration", + "examples/server_interaction_detailed", ] diff --git a/examples/orders/src/lib.rs b/examples/orders/src/lib.rs index 5fba5466b..247def14b 100644 --- a/examples/orders/src/lib.rs +++ b/examples/orders/src/lib.rs @@ -1,9 +1,9 @@ #[macro_use] extern crate seed; -use seed::prelude::*; use futures::prelude::*; use gloo_timers::future::TimeoutFuture; +use seed::prelude::*; // Model @@ -34,26 +34,26 @@ fn update(msg: Msg, model: &mut Model, orders: &mut Orders) { .send_msg(Msg::WriteHello) .send_msg(Msg::WriteName("World".into())) .perform_cmd(write_exclamation_marks_after_delay()) - .perform_cmd(write_emoticon_after_delay(":)".into())); + .perform_cmd(write_emoticon_after_delay("🙂".into())); } Msg::WriteHello => model.title.push_str("Hello "), Msg::WriteName(name) => model.title.push_str(&name), Msg::WriteExclamationMarks => model.title.push_str("!!! "), Msg::WriteEmoticon(emoticon) => model.title.push_str(&emoticon), Msg::TimeoutError => { - log!("Timeout failed!"); + error!("Timeout failed!"); orders.skip(); } } } -fn write_exclamation_marks_after_delay() -> impl Future { +fn write_exclamation_marks_after_delay() -> impl Future { TimeoutFuture::new(1_000) .map(|_| Msg::WriteExclamationMarks) .map_err(|_| Msg::TimeoutError) } -fn write_emoticon_after_delay(emoticon: String) -> impl Future { +fn write_emoticon_after_delay(emoticon: String) -> impl Future { TimeoutFuture::new(2_000) .map(|_| Msg::WriteEmoticon(emoticon)) .map_err(|_| Msg::TimeoutError) @@ -61,7 +61,6 @@ fn write_emoticon_after_delay(emoticon: String) -> impl Future impl ElContainer { div![ style![ @@ -73,9 +72,7 @@ fn view(model: &Model) -> impl ElContainer { "height" => "50vmin"; ], if model.greet_clicked { - h1![ - model.title - ] + h1![model.title] } else { div![ style![ @@ -85,7 +82,8 @@ fn view(model: &Model) -> impl ElContainer { "cursor" => "pointer"; "box-shadow" => "0 0.5vmin 0.5vmin green"; ], - simple_ev(Ev::Click, Msg::Greet), "Greet!" + simple_ev(Ev::Click, Msg::Greet), + "Greet!" ] } ] diff --git a/examples/server_interaction/src/lib.rs b/examples/server_interaction/src/lib.rs index db972728f..9f13f0f41 100644 --- a/examples/server_interaction/src/lib.rs +++ b/examples/server_interaction/src/lib.rs @@ -86,7 +86,6 @@ impl Default for Model { } } - #[derive(Clone)] enum Msg { Replace(Branch), @@ -101,16 +100,12 @@ fn update(msg: Msg, model: &mut Model, orders: &mut Orders) { Msg::Replace(data) => model.data = data, Msg::GetData => { - orders - .skip() - .perform_cmd(get_data()); - }, + orders.skip().perform_cmd(get_data()); + } Msg::Send => { - orders - .skip() - .perform_cmd(send()); - }, + orders.skip().perform_cmd(send()); + } Msg::OnServerResponse(result) => { log!(format!("Response: {:?}", result)); @@ -118,13 +113,12 @@ fn update(msg: Msg, model: &mut Model, orders: &mut Orders) { } Msg::OnFetchErr(err) => { - log!(format!("Fetch error: {:?}", err)); + error!(format!("Fetch error: {:?}", err)); orders.skip(); } } } - fn view(model: &Model) -> Vec> { vec![ div![format!( diff --git a/examples/server_interaction_detailed/.gitignore b/examples/server_interaction_detailed/.gitignore deleted file mode 100644 index 6c1daf5eb..000000000 --- a/examples/server_interaction_detailed/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/target -**/*.rs.bk -Cargo.lock - -**/pkg/* -**/.wasm \ No newline at end of file diff --git a/examples/server_interaction_detailed/Cargo.lock b/examples/server_interaction_detailed/Cargo.lock new file mode 100644 index 000000000..5f99b1e12 --- /dev/null +++ b/examples/server_interaction_detailed/Cargo.lock @@ -0,0 +1,658 @@ +[[package]] +name = "aho-corasick" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bumpalo" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cc" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "chrono" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "env_logger" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getopts" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "humantime" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "js-sys" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "me" +version = "0.1.0" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "seed 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "shared 0.1.0", + "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nom" +version = "4.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.29" +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)", +] + +[[package]] +name = "pulldown-cmark" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "reports" +version = "0.1.0" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "seed 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "shared 0.1.0", + "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ryu" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "seed" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", + "pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "shared" +version = "0.1.0" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sourcefile" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (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 = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.33 (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 = "termcolor" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-segmentation" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-width" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen-webidl" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "web-sys" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", + "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-webidl 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "weedle" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wincolor" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" +"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" +"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum bitflags 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bd1fa8ad26490b0a5cfec99089952250301b6716cdeaa7c9ab229598fb82ab66" +"checksum bumpalo 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4639720be048090544634e0402490838995ccdc9d2fe648f528f30d3c33ae71f" +"checksum cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a0c56216487bb80eec9c4516337b2588a4f2a2290d72a1416d930e4dcdb0c90d" +"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" +"checksum console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211" +"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "62941eff9507c8177d448bd83a44d9b9760856e184081d8cd79ba9f03dd24981" +"checksum getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)" = "72327b15c228bfe31f1390f93dd5e9279587f0463836393c9df719ce62a3e450" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum js-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e9c0d432259f651d765d888e30164c096ddbae13c89e56dd1d02a719e020efa8" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)" = "c6785aa7dd976f5fbf3b71cfd9cd49d7f783c1ff565a858d71031c6c313aa5c6" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" +"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" +"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" +"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +"checksum proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)" = "64c827cea7a7ab30ce4593e5e04d7a11617ad6ece2fa230605a78b00ff965316" +"checksum pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" +"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" +"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" +"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" +"checksum seed 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c34294be5cdaa620c13ea87e6a71e2f0e031ac6e22b5decf5410cd32c9f8414d" +"checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" +"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" +"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" +"checksum syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)" = "ec52cd796e5f01d0067225a5392e70084acc4c0013fa71d55166d38a8b307836" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" +"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" +"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum wasm-bindgen 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "546e4ab1bf7f9a3532d21472efd72d01a23f55abd885c60b165f393394dbad95" +"checksum wasm-bindgen-backend 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "7b84bedebfd6ae3522cce59dec6b52ee6c53ceeaae8541668c15b9f42df8ecab" +"checksum wasm-bindgen-futures 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "c6fc76797785881eac82f72e9b676032a737dea717103878100dbf6106d8d2cb" +"checksum wasm-bindgen-macro 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "f2a033fc6bfd5e486a488b0e19d7d1bb29e667ebb91db85f698381a8aa831786" +"checksum wasm-bindgen-macro-support 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "fba68375ef8f095c4a169c093c95ed2e1b5e44f7872f3bcbcafe2c51b4a80480" +"checksum wasm-bindgen-shared 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "321949f4d7f7bf7a49dccd464bdc46581b180f761d9505e4943926d50b2a4a64" +"checksum wasm-bindgen-webidl 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b8c2c2b45b827f96657beea954a5430d37da4cf477d2874595f5f0a6ad027980" +"checksum web-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "47ad2ecfe3793a87a0aa49562ad6f01cb3af3c870213283bc60032ec8dd7e62a" +"checksum weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26a4c67f132386d965390b8a734d5d10adbcd30eb5cc74bd9229af8b83f10044" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" diff --git a/examples/server_interaction_detailed/Cargo.toml b/examples/server_interaction_detailed/Cargo.toml index 6dce8eb2c..9f654d667 100644 --- a/examples/server_interaction_detailed/Cargo.toml +++ b/examples/server_interaction_detailed/Cargo.toml @@ -1,23 +1,22 @@ [package] -name = "server-interaction-detailed" +name = "shared" version = "0.1.0" authors = ["Your Name "] edition = "2018" - -[lib] -path = "src/reports.rs" -crate-type = ["cdylib"] - - [dependencies] -seed = "^0.3.2" -wasm-bindgen = "^0.2.42" -web-sys = "^0.3.19" +js-sys = "^0.3.20" # For serialization, eg sending requests to a server. Otherwise, not required. serde = { version = "^1.0.85", features = ['derive'] } -serde_json = "^1.0.33" +#serde_json = "^1.0.33" chrono = { version = "^0.4.6", features = ["serde"] } -futures = "^0.1.26" \ No newline at end of file +#futures = "^0.1.26" + + +[workspace] +members = [ + "me", + "reports", +] \ No newline at end of file diff --git a/examples/server_interaction_detailed/Makefile.toml b/examples/server_interaction_detailed/Makefile.toml index 8a9f342a4..52eb3df8f 100644 --- a/examples/server_interaction_detailed/Makefile.toml +++ b/examples/server_interaction_detailed/Makefile.toml @@ -1,17 +1,103 @@ -extend = "../../Makefile.toml" - -# ---- BUILD ---- +[env] +# all workspace members can use this Makefile +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true" +PORT = "8000" +# ---- BUILD & CREATE WASMS ---- [tasks.build] -alias = "default_build" +description = "Build" +workspace = false +command = "cargo" +args = ["build"] [tasks.build_release] -alias = "default_build_release" +description = "Build, with the --release flag" +workspace = false +command = "cargo" +args = ["build", "--release"] + +[tasks.create_wasm] +description = "Build with wasm-pack" +install_crate = "wasm-pack" +command = "wasm-pack" +args = ["build", "--target", "no-modules", "--out-name", "${@}", "--out-dir", "../pucks/static/pkg", "--dev"] + + +[tasks.create_wasm_release] +description = "Build with wasm-pack" +install_crate = "wasm-pack" +command = "wasm-pack" +args = ["build", "--target", "no-modules", "--out-name", "${@}", "--out-dir", "../pucks/static/pkg"] + +[tasks.all] +description = "Build, and create wasms" +workspace = false +dependencies = ["build", "create_wasm"] + +[tasks.all_release] +description = "Build, and create wasms, with the --release flag" +workspace = false +dependencies = ["build_release", "create_wasm_release"] + +[tasks.serve] +description = "Start server" +install_crate = { crate_name = "microserver", binary = "microserver", test_arg = "-h" } +workspace = false +command = "microserver" +args = ["--port", "${PORT}"] + + + + +# Confusing name build with above +[tasks.build_reports] +description = "" +workspace = false +command = "cargo" +args = ["make", "--cwd", "./reports", "all"] + +[tasks.build_me] +description = "" +workspace = false +command = "cargo" +args = ["make", "--cwd", "./me", "all"] + +[tasks.build_all] +description = "Build, and create wasms" +workspace = false +dependencies = ["build_reports", "build_me"] + + + +# ---- TEST ---- + +[tasks.test] +description = "Run tests. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]" +clear = true +workspace = false +install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } +command = "wasm-pack" +args = ["test", "--${@}"] + +[tasks.test_release] +extend = "test" +description = "Run tests in release mode. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]" +args = ["test", "--${@}", "--release"] -# ---- START ---- +[tasks.test_h] +description = "Run headless tests. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]" +extend = "test" +args = ["test", "--headless", "--${@}"] -[tasks.start] -alias = "default_start" +[tasks.test_h_release] +extend = "test_h" +description = "Run headless tests in release mode. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]" +args = ["test", "--headless", "--${@}", "--release"] -[tasks.start_release] -alias = "default_start_release" \ No newline at end of file +[tasks.test_one] +description = "Run Seed's tests. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]" +clear = true +workspace = false +install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } +command = "wasm-pack" +args = ["test", "--firefox", "--headless", "--", "--lib", "${@}"] \ No newline at end of file diff --git a/examples/server_interaction_detailed/README.md b/examples/server_interaction_detailed/README.md index 676e964c5..bc6bcba10 100644 --- a/examples/server_interaction_detailed/README.md +++ b/examples/server_interaction_detailed/README.md @@ -1,14 +1,16 @@ ## Server interaction detailed example (WIP) -A more complicated example of retrieving and using data from a server. It's intended +A more complicated example of retrieving and using data from a server, and outputing + multiple wasm files. It's intended to imitate a realistic use. You may compile and run this example, but it will not work as intended, since the server is not-yet included. You may still find examining the files useful. --- +Navigate to one of the subdirectories (eg, `reports`), and run. ```bash -cargo make start +cargo make all ``` -Open [127.0.0.1:8000](http://127.0.0.1:8000) in your browser. +Open [127.0.0.1:8000](http://127.0.0.1:8000) in your browser. \ No newline at end of file diff --git a/examples/server_interaction_detailed/index.html b/examples/server_interaction_detailed/index.html deleted file mode 100644 index cde8f710b..000000000 --- a/examples/server_interaction_detailed/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - A Title - - - -
- - - - - - - diff --git a/examples/server_interaction_detailed/me/Cargo.toml b/examples/server_interaction_detailed/me/Cargo.toml new file mode 100644 index 000000000..4f6f0ace8 --- /dev/null +++ b/examples/server_interaction_detailed/me/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "me" +version = "0.1.0" +authors = ["David O'Connor , @@ -21,8 +18,8 @@ struct Model { gradesheets: Vec, instructors: Vec, missions: Vec, - mx_start: Date, - mx_end: Date, + mx_start: datetime::Date, + mx_end: datetime::Date, } impl Default for Model { @@ -37,8 +34,8 @@ impl Default for Model { gradesheets: Vec::new(), instructors: Vec::new(), missions: Vec::new(), - mx_start: chrono::Utc.ymd(1999, 9, 9), - mx_end: chrono::Utc.ymd(1999, 9, 9), + mx_start: datetime::Date::new(1999, 9, 9), + mx_end: datetime::Date::new(1999, 9, 9), } } } @@ -72,8 +69,8 @@ enum Msg { LoadInitial(ServerData), OnFetchErr(JsValue), - ChangeMxStart(chrono::Date), - ChangeMxEnd(chrono::Date), + ChangeMxStart(datetime::Date), + ChangeMxEnd(datetime::Date), } fn update(msg: Msg, model: &mut Model) -> Update { @@ -89,7 +86,7 @@ fn update(msg: Msg, model: &mut Model) -> Update { } Msg::OnFetchErr(err) => { - log!(format!("Fetch error: {:?}", err)); // todo switch to error! once new seed version released + log!(format!("Fetch error: {:?}", err)); // todo switch to error! once new seed version released Skip.into() } @@ -109,7 +106,7 @@ fn gradesheets(model: &Model) -> El { section![] } -fn mx_effectivity(lines: &Vec, mx_start: &Date, mx_end: &Date) -> El { +fn mx_effectivity(lines: &Vec, mx_start: &datetime::Date, mx_end: &datetime::Date) -> El { // let lines_filtered = lines.iter().filter(l ) let lines_filtered = lines; @@ -130,20 +127,20 @@ fn mx_effectivity(lines: &Vec, mx_start: &Date, mx_end: &Date) - let percent = |num: usize| { let val = match lines_filtered.len() { 0 => num as f32 / lines_filtered.len() as f32, - _ => 0., + _ => 0. }; (val * 100.).to_string() + &"%" }; - let margin_style = style! {"margin-right" => 60}; + let margin_style = style!{"margin-right" => 60}; let display_block = |val: usize, title: &str| { div![ - style! {"display" => "flex"}, - h3![&margin_style, title], - h3![&margin_style, val.to_string()], - h3![percent(val)], - ] + style!{"display" => "flex"}, + h3![&margin_style, title], + h3![&margin_style, val.to_string()], + h3![percent(val)], + ] }; section![ @@ -155,7 +152,8 @@ fn mx_effectivity(lines: &Vec, mx_start: &Date, mx_end: &Date) - style! {"display" => "flex"; "margin-bottom" => 60}, h3!["Start"], h3!["End"], - ], + ], + display_block(eff, "Effective:"), display_block(ne_wx, "Non-effective weather:"), display_block(ne_ops, "Non-effective ops:"), @@ -182,31 +180,33 @@ fn display_pct2(len: usize, whole: &Vec) -> String { } } + + fn sortie_types(lines: &Vec, people: &Vec, missions: &Vec) -> El { let lookback_days = 60; // todo make adjustable - // let min_date = Utc::today() - Duration::days(lookback_days); - // let today = Utc::today(); + let today = datetime::Date::today(); + + let min_date = today.sub(chrono::Duration::days(lookback_days)); let mut rows: Vec> = Vec::new(); +// log!(format!("{:?}", today)); + for person in people.iter().filter(|p| util::is_aircrew(*p)) { // todo person_lines is much too verbose. let person_lines: Vec<&Line> = lines .into_iter() .filter(|l| { - // todo handle l_date in deser - // let l_date = Utc - // .datetime_from_str(&l.date, "%Y-%m-%d") - // .expect("Can't format date") - // .date(); + let l_date = datetime::Date::from_iso(&l.date); if let Some(pilot_id) = l.pilot { let pilot = people.iter().find(|p| p.id == pilot_id); // .expect("Can't find pilot"); // if pilot.id == person.id && min_date <= l_date && l_date <= today { if let Some(pilot) = pilot { - if pilot.id == person.id { +// if pilot.id == person.id { + if pilot.id == person.id && min_date <= l_date && l_date <= today { return true; } } @@ -217,7 +217,8 @@ fn sortie_types(lines: &Vec, people: &Vec, missions: &Vec // .expect("Can't find WSO"); // if wso.id == person.id && min_date <= l_date && l_date <= today { if let Some(wso) = wso { - if wso.id == person.id { +// if wso.id == person.id { + if wso.id == person.id && min_date <= l_date && l_date <= today { return true; } } diff --git a/examples/server_interaction_detailed/src/datetime.rs b/examples/server_interaction_detailed/src/datetime.rs new file mode 100644 index 000000000..48a24f35b --- /dev/null +++ b/examples/server_interaction_detailed/src/datetime.rs @@ -0,0 +1,164 @@ +use std::cmp::Ordering; +use std::fmt; + +use chrono; +use chrono::offset::TimeZone; +use chrono::{Datelike}; +use js_sys; + + +type Cdate = chrono::Date; + +/// Wrap the Chrono date, with a simpler API, and compatibility with features not supported +/// for it with the wasm target. +/// For now, utc only. +/// +/// 1-based month and day indexing. +#[derive(Clone)] +pub struct Date { + wrapped: Cdate, +} +// +//impl Ord for Date { +// fn cmp(&self, other: &Date) -> Ordering { +//// self.height.cmp(&other.height) +// +// let year_diff = self.year as u16 - other.year as u16; +// if year_diff > 0 { +// return self.year.cmp(other.year) +// } else if year_diff < 0 { +// return other.year.cmp(self.year) +// } else { +// +// let month_diff = self.month as i8 - othermonth as i8; +// if month_diff > 0 { +// return self.month.cmp(other.month) +// } else if month_diff < 0 { +// return other.month.cmp(self.month) +// } else { +// +// let day = self.day as i8 - other.day as i8; +// if day_diff > 0 { +// return self.day.cmp(other.day) +// } else if day_diff < 0 { +// return other.day.cmp(self.day) +// } +// } +// } +// } +// return self.day.cmp(other.day) // they equal eaqch other. +//} + +impl PartialEq for Date { + fn eq(&self, other: &Self) -> bool { + self.wrapped == other.wrapped + } +} + +impl PartialOrd for Date { + fn partial_cmp(&self, other: &Date) -> Option { + Some(self.wrapped.cmp(&other.wrapped)) + } +} + +///// todo From? +//impl From<&str> for Date { +// fn from(iso_date: &str) -> Self { +// // todo regex? Validation? +// let date = iso_date.to_string(); +// +// let year = &date[0..4]; +// let month = &date[7..9]; +// let day = &date[11..13]; +// +// Self { +// year: year.parse::().expect("Problem parsing year"), +// month: month.parse::().expect("Problem parsing month"), +// day: day.parse::().expect("Problem parsing day"), +// } +// } +//} + +impl fmt::Debug for Date { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}, {:?}", self.wrapped, self.wrapped.format("%Y-%h-%D").to_string()) + } +} + +//impl Add for Date { +// type Output = Self; +// +// fn add(self, dur: chrono::Duration) -> Self { +// Self { +// wrapped: self.wrapped + dur +// } +// } +//} +// +//impl Sub for Date { +// type Output = Self; +// +// fn sub(self, dur: chrono::Duration) -> Self { +// Self { +// wrapped: self.wrapped - dur +// } +// } +//} + +impl From for Date { + fn from(date: Cdate) -> Self { + Self { + wrapped: date + } + } +} + +impl Date { + pub fn new(year: i32, month: u32, day: u32) -> Self { + Self{ + wrapped: chrono::Utc.ymd(year, month, day) + } + } + + /// We use js_sys::Date, serialize it, then turn it into a Chrono date, due to limitations + /// with Crono on the wasm target. + pub fn today() -> Self { + let today_js = js_sys::Date::new_0(); + + Self::new( + today_js.get_utc_full_year() as i32, + today_js.get_utc_month() as u32 + 1, // JS using 0-based month indexing. Fix it. + today_js.get_utc_date() as u32, + ) + } + + /// Convert an iso-format date, eg "2019-01-05" for January 5, 2019" to a Date. + pub fn from_iso(date: &str) -> Self { + // Chrono needs time too, and can't parse date-only directly. + let padded = &(date.to_string() + "T000000"); + Self { + wrapped: chrono::Utc + .datetime_from_str(padded, "%Y-%m-%dT%H%M%S") + .expect(&format!("Can't format date: {}", date)) + .date() + } + } + + // todo operator overload with other being diff type? + pub fn add(&self, dur: chrono::Duration) -> Self { + Self { + wrapped: self.wrapped.clone() + dur + } + } + + pub fn sub(&self, dur: chrono::Duration) -> Self { + Self { + wrapped: self.wrapped.clone() - dur + } + } + + /// Getters/setters. Perhaps there's a better way. + pub fn year(&self) -> u16 { + self.wrapped.year() as u16 + } +} \ No newline at end of file diff --git a/examples/server_interaction_detailed/src/lib.rs b/examples/server_interaction_detailed/src/lib.rs new file mode 100644 index 000000000..79cd8b02a --- /dev/null +++ b/examples/server_interaction_detailed/src/lib.rs @@ -0,0 +1,3 @@ +pub mod datetime; +pub mod util; +pub mod interfaces; \ No newline at end of file diff --git a/examples/server_interaction_detailed/src/util.rs b/examples/server_interaction_detailed/src/util.rs index dd2c30241..d9d3ebbca 100644 --- a/examples/server_interaction_detailed/src/util.rs +++ b/examples/server_interaction_detailed/src/util.rs @@ -1,10 +1,20 @@ +use std::cmp::Ordering; +use std::fmt; +use std::ops::{Add, Sub}; + use crate::interfaces::{Line, Person}; +//use chrono::Datelike; + +// We use these integers instead of enums for compatibility with the database and serialization. +pub const PILOT_JOB: i8 = 0; +pub const WSO_JOB: i8 = 1; -// @TODO: edit this, it's just placeholder so project can be build +pub const MX_UNK: i8 = -1; pub const MX_EFF: i8 = 0; +pub const MX_NE_WX: i8 = 1; +pub const MX_NE_OPS: i8 = 2; +pub const MX_NE_MX: i8 = 3; -const PILOT_JOB: i8 = 0; -const WSO_JOB: i8 = 1; pub fn short_name(person: &Person) -> String { format! {"{}, {}", person.last_name, person.first_name} @@ -48,4 +58,4 @@ pub fn formation_lines(selected_line: &Line, lines: &Vec) -> Vec { pub fn is_aircrew(person: &Person) -> bool { person.job == PILOT_JOB || person.job == WSO_JOB -} +} \ No newline at end of file diff --git a/examples/websocket/src/client.rs b/examples/websocket/src/client.rs index 0dda1f084..ff18f8788 100644 --- a/examples/websocket/src/client.rs +++ b/examples/websocket/src/client.rs @@ -35,7 +35,7 @@ fn update(msg: Msg, mut model: &mut Model, orders: &mut Orders) { match msg { Msg::Connected => { model.connected = true; - }, + } Msg::ServerMsg(msg) => { model.connected = true; model.msg_rx_cnt += 1; @@ -43,10 +43,10 @@ fn update(msg: Msg, mut model: &mut Model, orders: &mut Orders) { } Msg::EditChange(input_text) => { model.input_text = input_text; - }, + } Msg::Send(_) => { orders.skip(); - }, + } Msg::Sent => { model.input_text = "".into(); model.msg_tx_cnt += 1; diff --git a/src/fetch.rs b/src/fetch.rs index 858263b5b..6f8f1a4f7 100644 --- a/src/fetch.rs +++ b/src/fetch.rs @@ -16,8 +16,6 @@ use serde::de::DeserializeOwned; use serde::Serialize; use serde_json; -// todo once this is polished, publish as a standalone crate. - /// HTTP Method types /// /// # References diff --git a/src/lib.rs b/src/lib.rs index 2c49cbbb5..87c95e548 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,12 +16,12 @@ pub mod shortcuts; pub mod dom_types; pub mod fetch; +mod next_tick; pub mod routing; pub mod storage; mod util; mod vdom; mod websys_bridge; -mod next_tick; //// todos: // todo Give 'components' their own message type/update fn. Could help efficient rendering, @@ -127,7 +127,7 @@ pub mod tests { fn update(msg: Msg, model: &mut Model, _: &mut Orders) { match msg { - Msg::Increment => model.val += 1 + Msg::Increment => model.val += 1, } } diff --git a/src/next_tick.rs b/src/next_tick.rs index 53af7b7f3..ea8ec8489 100644 --- a/src/next_tick.rs +++ b/src/next_tick.rs @@ -42,4 +42,4 @@ impl Future for NextTick { ), } } -} \ No newline at end of file +} diff --git a/src/vdom.rs b/src/vdom.rs index 66eb00aab..98465642b 100644 --- a/src/vdom.rs +++ b/src/vdom.rs @@ -1,24 +1,24 @@ use crate::{ dom_types, dom_types::{El, ElContainer, Namespace}, - routing, util, websys_bridge, next_tick, + next_tick, routing, util, websys_bridge, }; +use enclose::enclose; use futures::Future; +use next_tick::NextTick; use std::{ cell::RefCell, - collections::{HashMap, vec_deque::VecDeque}, + collections::{vec_deque::VecDeque, HashMap}, panic, rc::Rc, }; use wasm_bindgen::closure::Closure; use wasm_bindgen_futures::spawn_local; use web_sys::{Document, Element, Event, EventTarget, Window}; -use next_tick::NextTick; -use enclose::enclose; pub enum Effect { Msg(Ms), - Cmd(Box + 'static>), + Cmd(Box + 'static>), } impl From for Effect { @@ -81,8 +81,8 @@ impl Orders { ///orders.perform_cmd(write_emoticon_after_delay()); /// ``` pub fn perform_cmd(&mut self, cmd: C) -> &mut Self - where - C: Future + 'static, + where + C: Future + 'static, { self.effects.push_back(Effect::Cmd(Box::new(cmd))); self @@ -136,10 +136,10 @@ pub struct AppData { } pub struct AppCfg - where - Ms: 'static, - Mdl: 'static, - ElC: ElContainer, +where + Ms: 'static, + Mdl: 'static, + ElC: ElContainer, { document: web_sys::Document, mount_point: web_sys::Element, @@ -149,10 +149,10 @@ pub struct AppCfg } pub struct App - where - Ms: 'static, - Mdl: 'static, - ElC: ElContainer, +where + Ms: 'static, + Mdl: 'static, + ElC: ElContainer, { /// Stateless app configuration pub cfg: Rc>, @@ -160,9 +160,7 @@ pub struct App pub data: Rc>, } -impl> ::std::fmt::Debug -for App -{ +impl> ::std::fmt::Debug for App { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { write!(f, "App") } @@ -391,7 +389,7 @@ impl + 'static> App { let mut new_effects = self.process_queue_message(msg); msg_and_cmd_queue.append(&mut new_effects); } - Effect::Cmd(cmd) => self.process_queue_cmd(cmd) + Effect::Cmd(cmd) => self.process_queue_cmd(cmd), } } } @@ -412,7 +410,7 @@ impl + 'static> App { orders.effects } - fn process_queue_cmd(&self, cmd: Box>) { + fn process_queue_cmd(&self, cmd: Box>) { let lazy_schedule_cmd = enclose!((self => s) move |_| { // schedule future (cmd) to be executed spawn_local(cmd.then(move |res| { @@ -479,8 +477,8 @@ impl + 'static> App { } pub fn add_message_listener(&self, listener: F) - where - F: Fn(&Ms) + 'static, + where + F: Fn(&Ms) + 'static, { self.data .msg_listeners @@ -500,8 +498,8 @@ impl + 'static> App { /// doesn't trigger a re-render, or if something else modifies them using a side effect. /// Handle controlled inputs: Ie force sync with the model. fn setup_input_listener(el: &mut El) - where - Ms: 'static, +where + Ms: 'static, { if el.tag == dom_types::Tag::Input || el.tag == dom_types::Tag::Select @@ -526,8 +524,8 @@ fn setup_input_listener(el: &mut El) // Create the web_sys element; add it to the working tree; store it in its corresponding vdom El. fn setup_websys_el(document: &Document, el: &mut El) - where - Ms: 'static, +where + Ms: 'static, { if el.el_ws.is_none() { el.el_ws = Some(websys_bridge::make_websys_el(el, document)); @@ -536,16 +534,16 @@ fn setup_websys_el(document: &Document, el: &mut El) /// Recursively sets up input listeners fn setup_input_listeners(el_vdom: &mut El) - where - Ms: 'static, +where + Ms: 'static, { el_vdom.walk_tree_mut(setup_input_listener); } /// Recursively sets up web_sys elements fn setup_websys_el_and_children(document: &Document, el: &mut El) - where - Ms: 'static, +where + Ms: 'static, { el.walk_tree_mut(|el| setup_websys_el(document, el)); } @@ -653,7 +651,7 @@ pub(crate) fn patch<'a, Ms, Mdl, ElC: ElContainer>( } return None; - // If new and old are empty, we don't need to do anything. + // If new and old are empty, we don't need to do anything. } else if new.empty && old.empty { return None; } @@ -913,9 +911,9 @@ pub mod tests { use crate as seed; // required for macros to work. use crate::{class, prelude::*}; + use futures::future; use wasm_bindgen::JsCast; use web_sys::{Node, Text}; - use futures::future; #[derive(Clone, Debug)] enum Msg {} @@ -941,11 +939,11 @@ pub mod tests { new_vdom } - fn iter_nodelist(list: web_sys::NodeList) -> impl Iterator { + fn iter_nodelist(list: web_sys::NodeList) -> impl Iterator { (0..list.length()).map(move |i| list.item(i).unwrap()) } - fn iter_child_nodes(node: &Node) -> impl Iterator { + fn iter_child_nodes(node: &Node) -> impl Iterator { iter_nodelist(node.child_nodes()) } @@ -1414,7 +1412,7 @@ pub mod tests { /// Tests an update() function that repeatedly sends messages or performs commands. #[wasm_bindgen_test(async)] - fn update_promises() -> impl Future { + fn update_promises() -> impl Future { // ARRANGE // when we call `test_value_sender.send(..)`, future `test_value_receiver` will be marked as resolved @@ -1450,7 +1448,7 @@ pub mod tests { match msg { Msg::MessageReceived => model.counters.messages_received += 1, Msg::CommandPerformed => model.counters.commands_performed += 1, - Msg::Start => () + Msg::Start => (), } if model.counters.messages_sent < MESSAGES_TO_SEND { @@ -1465,7 +1463,8 @@ pub mod tests { if model.counters.messages_received == MESSAGES_TO_SEND && model.counters.commands_performed == COMMANDS_TO_PERFORM { - model.test_value_sender + model + .test_value_sender .take() .unwrap() .send(model.counters) @@ -1473,13 +1472,17 @@ pub mod tests { } } - let app = App::build(Model { - test_value_sender: Some(test_value_sender), - ..Default::default() - }, update, |_| seed::empty()) - .mount(seed::body()) - .finish() - .run(); + let app = App::build( + Model { + test_value_sender: Some(test_value_sender), + ..Default::default() + }, + update, + |_| seed::empty(), + ) + .mount(seed::body()) + .finish() + .run(); // ACT app.update(Msg::Start); diff --git a/src/websys_bridge.rs b/src/websys_bridge.rs index e42ee9412..68ec320a5 100644 --- a/src/websys_bridge.rs +++ b/src/websys_bridge.rs @@ -3,7 +3,7 @@ use wasm_bindgen::JsCast; use crate::dom_types; use crate::dom_types::{El, ElContainer}; -use crate::vdom::{App}; +use crate::vdom::App; /// Add a shim to make check logic more natural than the DOM handles it. fn set_attr_shim(el_ws: &web_sys::Node, at: &dom_types::At, val: &str) {