0.1.0 • Published 5 years ago

@cwilkes/bouncingball v0.1.0

Weekly downloads
1
License
MIT/Apache-2.0
Repository
github
Last release
5 years ago

A template for kick starting a Rust and WebAssembly project using wasm-pack.

Built with 🦀🕸 by The Rust and WebAssembly Working Group

Chris

cargo install cargo-wasm
cargo wasm setup


   Compiling bouncingball v0.1.0 (/Users/cwilkes/Documents/workspace/bouncingball)
error[E0401]: can't use generic parameters from outer function
  --> src/lib.rs:57:31
   |
56 | impl Universe {
   | ---- `Self` type implicitly declared here, by this `impl`
57 |     pub fn advance(self: &mut Self) -> Universe {
   |                               ^^^^
   |                               |
   |                               use of generic parameter from outer function
   |                               use a type here instead

error[E0277]: the trait bound `Universe: wasm_bindgen::convert::IntoWasmAbi` is not satisfied
  --> src/lib.rs:55:1
   |
55 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ the trait `wasm_bindgen::convert::IntoWasmAbi` is not implemented for `Universe`
   |
   = note: required because of the requirements on the impl of `wasm_bindgen::convert::ReturnWasmAbi` for `Universe`

error[E0277]: the trait bound `Universe: wasm_bindgen::convert::IntoWasmAbi` is not satisfied
  --> src/lib.rs:55:1
   |
55 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ the trait `wasm_bindgen::convert::IntoWasmAbi` is not implemented for `Universe`
   |
   = note: required because of the requirements on the impl of `wasm_bindgen::convert::ReturnWasmAbi` for `Universe`

error: aborting due to 3 previous errors


npm init wasm-app www

https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm

About

📚 Read this template tutorial! 📚

This template is designed for compiling Rust libraries into WebAssembly and publishing the resulting package to NPM.

Be sure to check out other wasm-pack tutorials online for other templates and usages of wasm-pack.

🚴 Usage

🐑 Use cargo generate to Clone this Template

Learn more about cargo generate here.

cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project
cd my-project

🛠️ Build with wasm-pack build

wasm-pack build

🔬 Test in Headless Browsers with wasm-pack test

wasm-pack test --headless --firefox

🎁 Publish to NPM with wasm-pack publish

wasm-pack publish

🔋 Batteries Included