An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![Rust](https://github.com/RGGH/wasm-sdlt/actions/workflows/rust.yml/badge.svg)](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.