A repo for my personal website
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Changing to Rust and WebAssembly

+53
+10
.gitignore
··· 1 + # Generated by Cargo 2 + # will have compiled files and executables 3 + /target/ 4 + 5 + # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 6 + # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 7 + Cargo.lock 8 + 9 + # These are backup files generated by rustfmt 10 + **/*.rs.bk
+16
Cargo.toml
··· 1 + [package] 2 + name = "cbf-site" 3 + version = "0.1.0" 4 + authors = ["Cass Forest <cityboundforest@gmail.com>"] 5 + description = "My personal website built with WebAssembly and Rust" 6 + license = "MIT/Apache-2.0" 7 + repository = "https://github.com/skeetcha/skeetcha.github.io" 8 + edition = "2021" 9 + 10 + [lib] 11 + crate-type = ["cdylib"] 12 + 13 + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 14 + 15 + [dependencies] 16 + wasm-bindgen = "0.2.79"
+16
index.html
··· 1 + <!DOCTYPE html> 2 + <html> 3 + <head> 4 + <meta charset="utf-8"> 5 + <title>hello-wasm example</title> 6 + </head> 7 + <body> 8 + <script type="module"> 9 + import init, {greet} from "./pkg/cbf_site.js"; 10 + init() 11 + .then(() => { 12 + greet("WebAssembly") 13 + }); 14 + </script> 15 + </body> 16 + </html>
+11
src/lib.rs
··· 1 + use wasm_bindgen::prelude::*; 2 + 3 + #[wasm_bindgen] 4 + extern { 5 + pub fn alert(s: &str); 6 + } 7 + 8 + #[wasm_bindgen] 9 + pub fn greet(name: &str) { 10 + alert(&format!("Hello, {}!", name)); 11 + }