From dae1e76e35028e779d6e152811d1c4fe661fd9b6 Mon Sep 17 00:00:00 2001 From: DavidOConnor Date: Thu, 13 Dec 2018 13:36:54 -0500 Subject: [PATCH] Updated for update func taking Model, and removed nightly instructions --- .gitignore | 1 + Cargo.toml | 2 +- README.md | 9 +++------ src/lib.rs | 2 +- wasm-pack.log | 1 - 5 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 wasm-pack.log diff --git a/.gitignore b/.gitignore index fa2d508..df2ac7d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ pkg/*.wasm pkg/*.d.ts pkg/*.ts pkg/*.js +wasm-pack.log \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 08ed3e3..2997614 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -seed = "^0.1.0" +seed = "^0.1.2" wasm-bindgen = "^0.2.29" web-sys = "^0.3.6" diff --git a/README.md b/README.md index 0d98f62..491d0ee 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,16 @@ **To get started:** - Clone this repo -- If you don't have Rust installed, nightly set up, and wasm-bindgen, [Download it](https://www.rust-lang.org), and run the following commands: +- If you don't have Rust and wasm-bindgen installed, [Download it](https://www.rust-lang.org), and run the following commands: `rustup update` -`rustup default nightly` +`rustup target add wasm32-unknown-unknown` -`rustup target add wasm32-unknown-unknown --toolchain nightly` - -`cargo +nightly install wasm-bindgen-cli` +`cargo install wasm-bindgen-cli` - Run `build.sh` or `build.ps1`, then open `index.html` in a web browser, or use a local server. (Opening the file directly may not work in some browsers.) - Once you rename the crate in `Cargo.toml` (The `name` field under `[Package]`), make the following changes: diff --git a/src/lib.rs b/src/lib.rs index 09b103a..22fee04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,7 +27,7 @@ enum Msg { Increment, } -fn update(msg: Msg, model: &Model) -> Model { +fn update(msg: Msg, model: Model) -> Model { match msg { Msg::Increment => Model {val: model.val + 1} } diff --git a/wasm-pack.log b/wasm-pack.log deleted file mode 100644 index 470a5f6..0000000 --- a/wasm-pack.log +++ /dev/null @@ -1 +0,0 @@ -Dec 11 19:15:53.330 ERRO Compiling your crate to WebAssembly