Skip to content

Commit

Permalink
Merge pull request rustwasm#1108 from elpiel/port-examples-julia_set-…
Browse files Browse the repository at this point in the history
…no_modules-paint-performance-to-rust-2018

Port `julia_set`, `no_modules`, `paint` and `performance` to Rust 2018
  • Loading branch information
alexcrichton authored Dec 12, 2018
2 parents 82b322a + f29f78e commit df09df4
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 17 deletions.
1 change: 1 addition & 0 deletions examples/julia_set/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "julia_set"
version = "0.1.0"
authors = ["The wasm-bindgen Developers"]
edition = "2018"

[lib]
crate-type = ["cdylib"]
Expand Down
3 changes: 0 additions & 3 deletions examples/julia_set/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
extern crate wasm_bindgen;
extern crate web_sys;

use std::ops::Add;
use wasm_bindgen::prelude::*;
use wasm_bindgen::Clamped;
Expand Down
1 change: 1 addition & 0 deletions examples/no_modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "no_modules"
version = "0.1.0"
authors = ["The wasm-bindgen Developers"]
edition = "2018"

[lib]
crate-type = ["cdylib"]
Expand Down
3 changes: 0 additions & 3 deletions examples/no_modules/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
extern crate wasm_bindgen;
extern crate web_sys;

use wasm_bindgen::prelude::*;

// Called by our JS entry point to run the example
Expand Down
1 change: 1 addition & 0 deletions examples/paint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "wasm-bindgen-paint"
version = "0.1.0"
authors = ["The wasm-bindgen Developers"]
edition = "2018"

[lib]
crate-type = ["cdylib"]
Expand Down
10 changes: 3 additions & 7 deletions examples/paint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate js_sys;
extern crate wasm_bindgen;
extern crate web_sys;

use std::cell::Cell;
use std::rc::Rc;
use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -30,7 +26,7 @@ pub fn start() -> Result<(), JsValue> {
context.begin_path();
context.move_to(event.offset_x() as f64, event.offset_y() as f64);
pressed.set(true);
}) as Box<FnMut(_)>);
}) as Box<dyn FnMut(_)>);
canvas.add_event_listener_with_callback("mousedown", closure.as_ref().unchecked_ref())?;
closure.forget();
}
Expand All @@ -44,7 +40,7 @@ pub fn start() -> Result<(), JsValue> {
context.begin_path();
context.move_to(event.offset_x() as f64, event.offset_y() as f64);
}
}) as Box<FnMut(_)>);
}) as Box<dyn FnMut(_)>);
canvas.add_event_listener_with_callback("mousemove", closure.as_ref().unchecked_ref())?;
closure.forget();
}
Expand All @@ -55,7 +51,7 @@ pub fn start() -> Result<(), JsValue> {
pressed.set(false);
context.line_to(event.offset_x() as f64, event.offset_y() as f64);
context.stroke();
}) as Box<FnMut(_)>);
}) as Box<dyn FnMut(_)>);
canvas.add_event_listener_with_callback("mouseup", closure.as_ref().unchecked_ref())?;
closure.forget();
}
Expand Down
1 change: 1 addition & 0 deletions examples/performance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "performance"
version = "0.1.0"
authors = ["The wasm-bindgen Developers"]
edition = "2018"

[lib]
crate-type = ["cdylib"]
Expand Down
4 changes: 0 additions & 4 deletions examples/performance/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate humantime;
extern crate wasm_bindgen;
extern crate web_sys;

use std::time::{Duration, SystemTime, UNIX_EPOCH};

use wasm_bindgen::prelude::*;
Expand Down

0 comments on commit df09df4

Please sign in to comment.