wasm-pack-template
A template for kick starting a Rust and WebAssembly project using wasm-pack.
Tutorial | Chat
Built with 🦀🕸 by The Rust and WebAssembly Working GroupAbout
📚 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
-
wasm-bindgenfor communicating between WebAssembly and JavaScript. -
console_error_panic_hookfor logging panic messages to the developer console. -
wee_alloc, an allocator optimized for small code size. # Rust playground
Things I have recently done while learning the Rust programming language.
Synopsis
Change in one of the toplevel subdirectories and try cargo build or
cargo run. Maybe not everything is working oob. Feel free to fix whatever
you want.
Description
Various small examples I have tried while learning rust. The biggest and currently most active project is fractional which started as an implamentation of a rational number data type and then switched to a 3D math playground visualizing using XCB (in future it might also use a HTML5 Canvas for drawing as WebAssembly application. Using fractions with 3D math has several drawbacks:
- A huge part of 3D math is non rational, like sin, cos, tan and sqrt.
- The numerator and denominator tend to become very huge while nearing to non rational numbers and reduction is difficult and time consuming.
- Because of 2 it is way slower than the floating point calculation (at least with a decent coprocessor).
Anyway, implementing the vector math stuff for both fractions and floating point was a nice playground for generics and traits. In future I might add another data type which implements the math as done by David Braben for the elite computer game.
Requirements
Always
- A recent version of the Rust programming language as well as tooling. Currently I use Rust 1.39.0.
For fractional
- A running X Server with XCB and X11-SHM extentions
Dependencies
...
Contributing
Feel free to make pull requests as you like, no guarantee that the will be added.
License
Copyright © 2020 Georg Hopp
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Author
Georg Hopp georg@steffers.org