+

Hello World from Rust + WebAssembly

A blazingly fast web experience powered by Rust compiled to WebAssembly

terminal
$ cargo build --target wasm32-unknown-unknown
$ wasm-bindgen target/wasm32-unknown-unknown/debug/hello_world.wasm --out-dir ./pkg
$ npm run start
> Hello World from Rust WebAssembly!
_ |

Rust Code Example

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn greet(name: &str) -> String {
    format!("Hello, {} from Rust WebAssembly!", name)
}

#[wasm_bindgen]
pub fn fibonacci(n: u32) -> u32 {
    match n {
        0 => 0,
        1 => 1,
        _ => fibonacci(n - 1) + fibonacci(n - 2),
    }
}
                    

WebAssembly Output

Greeting Function

Output will appear here...

Fibonacci Sequence

Fibonacci result will appear here...