Skip to content

Commit e073bb9

Browse files
committed
Prep for 0.3.0 release
1 parent 2a79c70 commit e073bb9

File tree

9 files changed

+35
-20
lines changed

9 files changed

+35
-20
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## v0.3.0
4+
- `update` function now takes a mutable ref of the model. (Breaking)
5+
- `Update` (update's return type) is now a struct. (Breaking)
6+
- Async, etc events are now handled through messages, instead of passing `App`
7+
through the view func. (breaking)
8+
- Fixed some bugs with empty elements
9+
- Internal code cleanup
10+
- Added commented-out release command to example build files
11+
- Added more tests
12+
313
## v0.2.10
414
- Routing can be triggered by clicking any element containing a `Href` attribute
515
with value as a relative link

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "seed"
3-
version = "0.2.10"
3+
version = "0.3.0"
44
description = "A Rust framework for creating web apps, using WebAssembly"
55
authors = ["DavidOConnor <[email protected]>"]
66
license = "MIT"

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,14 @@ crate-type = ["cdylib"]
7676

7777
[dependencies]
7878
seed = "^0.2.4"
79-
wasm-bindgen = "^0.2.33"
79+
wasm-bindgen = "^0.2.38"
8080
web-sys = "^0.3.6"
8181
```
8282

8383
## A short example
8484
Here's an example demonstrating structure and syntax; it can be found in working form
85-
under `examples/counter`. Descriptions of its parts are in the
85+
in the [counter example](https://github.com/David-OConnor/seed/tree/master/examples/counter)
86+
Descriptions of its parts are in the
8687
Guide section below. Its structure follows [The Elm Architecture](https://guide.elm-lang.org/architecture/).
8788

8889
*lib.rs*:
@@ -119,13 +120,14 @@ enum Msg {
119120
ChangeWWC(String),
120121
}
121122

122-
/// The sole source of updating the model; returns a fresh one.
123-
fn update(msg: Msg, model: Model) -> Update<Msg, Model> {
123+
/// The sole source of updating the model
124+
fn update(msg: Msg, model: &mut Model) -> Update<Msg> {
124125
match msg {
125-
Msg::Increment => Render(Model {count: model.count + 1, ..model}),
126-
Msg::Decrement => Render(Model {count: model.count - 1, ..model}),
127-
Msg::ChangeWWC(what_we_count) => Render(Model {what_we_count, ..model })
126+
Msg::Increment => model.count += 1,
127+
Msg::Decrement => model.count -= 1,
128+
Msg::ChangeWWC(what_we_count) => model.what_we_count = what_we_count,
128129
}
130+
Render.into()
129131
}
130132

131133

@@ -143,7 +145,7 @@ fn success_level(clicks: i32) -> El<Msg> {
143145
}
144146

145147
/// The top-level component we pass to the virtual dom.
146-
fn view(state: seed::App<Msg, Model>, model: &Model) -> El<Msg> {
148+
fn view(model: &Model) -> El<Msg> {
147149
let plural = if model.count == 1 {""} else {"s"};
148150

149151
// Attrs, Style, Events, and children may be defined separately.
@@ -220,7 +222,7 @@ navigate to that folder in a terminal,
220222
run the build script for your system (`build.sh` or `build.ps1`), then start a dev server
221223
as described above. Note that if you copy an example to a separate folder, you'll need
222224
to edit its `Cargo.toml` to point to the package on [crates.io](https://crates.io) instead of locally: Ie replace
223-
`seed = { path = "../../"` with `seed = "^0.2.4"`, and in the build script, remove the leading `../../` on the second
225+
`seed = { path = "../../"` with `seed = "^0.3.0"`, and in the build script, remove the leading `../../` on the second
224226
line.
225227

226228

examples/server_integration/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22

33
A demonstration of sharing data structures between client and server when using
44
a Rust backend. This reduces duplication. Also provides examples of a simple get request.
5-
Uses Rocket for the backend. See the Guide for details.
5+
Uses Rocket for the backend.
6+
7+
To run, from this directory, run `cargo +nightly run`, and from the `frontend`
8+
subdirectory, run the build script and dev server as you would normally.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cargo build --target wasm32-unknown-unknown
2-
wasm-bindgen ../../../target/wasm32-unknown-unknown/debug/server_interaction.wasm --no-modules --out-dir ./pkg --out-name package
2+
wasm-bindgen ./target/wasm32-unknown-unknown/debug/frontend.wasm --no-modules --out-dir ./pkg --out-name package
33

44
#cargo build --target wasm32-unknown-unknown --release
5-
#wasm-bindgen ../../../target/wasm32-unknown-unknown/release/server_interaction.wasm --no-modules --out-dir ./pkg --out-name package
5+
#wasm-bindgen ./target/wasm32-unknown-unknown/release/frontend.wasm --no-modules --out-dir ./pkg --out-name package
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
cargo build --target wasm32-unknown-unknown
3-
wasm-bindgen ../../../target/wasm32-unknown-unknown/debug/frontend.wasm --no-modules --out-dir ./pkg --out-name package
3+
wasm-bindgen ./target/wasm32-unknown-unknown/debug/frontend.wasm --no-modules --out-dir ./pkg --out-name package
44

55
#cargo build --target wasm32-unknown-unknown --release
6-
#wasm-bindgen ../../../target/wasm32-unknown-unknown/release/frontend.wasm --no-modules --out-dir ./pkg --out-name package
6+
#wasm-bindgen ./target/wasm32-unknown-unknown/release/frontend.wasm --no-modules --out-dir ./pkg --out-name package

examples/server_integration/frontend/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[macro_use]
22
extern crate seed;
33
use seed::prelude::*;
4-
use seed::{spawn_local, Method, Request};
4+
use seed::{Method, Request};
55

66
use futures::Future;
77

@@ -28,7 +28,7 @@ fn get_data() -> impl Future<Item = Msg, Error = Msg> {
2828

2929
#[derive(Clone)]
3030
enum Msg {
31-
GetData(seed::App<Msg, Model>),
31+
GetData,
3232
Replace(Data),
3333
OnFetchErr(JsValue),
3434
}
@@ -55,7 +55,7 @@ fn view(model: &Model) -> El<Msg> {
5555
div![
5656
h1![format!("Val: {} Text: {}", model.data.val, model.data.text)],
5757
button![
58-
raw_ev("click", move |_| Msg::GetData()),
58+
raw_ev("click", move |_| Msg::GetData),
5959
"Update data"
6060
]
6161
]

examples/server_integration/shared/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use serde::{Serialize, Deserialize};
22

3-
#[derive(Default, Serialize, Deserialize)]
3+
#[derive(Clone, Default, Serialize, Deserialize)]
44
pub struct Data {
55
pub val: i8,
66
pub text: String,

examples/websocket/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Communicating with a server using WebSocket
22

33
Inlcludes an example Rust server (not related to Seed), and client. Both share datastructures
4-
in `json.rs`. To run, run `cargo run` in one terminal, and `python serve.py` in another.
4+
in `json.rs`. To run, build as normal, run `cargo run` in one terminal, and `python serve.py` in another.
55

66
Written by Flosse.

0 commit comments

Comments
 (0)