https://github.com/rggh/wasm-sdlt
UK Stamp Duty Land Tax calcultor - WASM
https://github.com/rggh/wasm-sdlt
rust wasm
Last synced: 23 days ago
JSON representation
UK Stamp Duty Land Tax calcultor - WASM
- Host: GitHub
- URL: https://github.com/rggh/wasm-sdlt
- Owner: RGGH
- Created: 2024-10-21T14:01:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-28T16:46:40.000Z (over 1 year ago)
- Last Synced: 2025-10-24T10:49:11.204Z (8 months ago)
- Topics: rust, wasm
- Language: HTML
- Homepage: https://rggh.github.io/wasm-sdlt/
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/RGGH/wasm-sdlt/actions/workflows/rust.yml)
# Build a simple web application using Rust and Web Assembly.
# Create a Rust Project
```cargo new tax-calc-wasm```
```cd tax-calc-wasm```
# Add wasm_bindgen crate
```cargo add wasm-bindgen```
# Edit Cargo.toml and add:
```
[lib]
crate-type = ["cdylib", "rlib"]
```
# Step 2: Writing the Rust Code
Edit src/lib.rs to implement the tax calculation logic:
```rust
// Importing wasm_bindgen crate to enable communication between JavaScript and Rust
use wasm_bindgen::prelude::*;
// Define the function that will be exposed to JavaScript
#[wasm_bindgen]
pub fn xyz () {
}
```
# Step 3: Building the Project
Build the project using wasm-pack:
```bash
wasm-pack build --target web
```
# Step 4: Setting Up the Web Environment
Create an index.html file in the tax-calculator-wasm directory
# Step 5: Serving the Project
To serve the project, you need a simple web server.
## http-server
http-server .
Navigate to http://localhost:8000 in your web browser to see the tax calculator in action.