Simple test project that sets up a hybrid cargo crate with a vite project

chore: enable some optimization stuff

Signed-off-by: Jonathan Basniak <9uknek65z@mozmail.com>

+74 -3
+56 -3
Cargo.lock
··· 20 20 21 21 [[package]] 22 22 name = "cfg-if" 23 + version = "0.1.10" 24 + source = "registry+https://github.com/rust-lang/crates.io-index" 25 + checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 26 + 27 + [[package]] 28 + name = "cfg-if" 23 29 version = "1.0.3" 24 30 source = "registry+https://github.com/rust-lang/crates.io-index" 25 31 checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" ··· 31 37 "console_error_panic_hook", 32 38 "wasm-bindgen", 33 39 "wasm-bindgen-test", 40 + "wee_alloc", 34 41 ] 35 42 36 43 [[package]] ··· 46 53 source = "registry+https://github.com/rust-lang/crates.io-index" 47 54 checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" 48 55 dependencies = [ 49 - "cfg-if", 56 + "cfg-if 1.0.3", 50 57 "wasm-bindgen", 51 58 ] 52 59 ··· 65 72 "once_cell", 66 73 "wasm-bindgen", 67 74 ] 75 + 76 + [[package]] 77 + name = "libc" 78 + version = "0.2.176" 79 + source = "registry+https://github.com/rust-lang/crates.io-index" 80 + checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" 68 81 69 82 [[package]] 70 83 name = "log" ··· 73 86 checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" 74 87 75 88 [[package]] 89 + name = "memory_units" 90 + version = "0.4.0" 91 + source = "registry+https://github.com/rust-lang/crates.io-index" 92 + checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" 93 + 94 + [[package]] 76 95 name = "minicov" 77 96 version = "0.3.7" 78 97 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 160 179 source = "registry+https://github.com/rust-lang/crates.io-index" 161 180 checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" 162 181 dependencies = [ 163 - "cfg-if", 182 + "cfg-if 1.0.3", 164 183 "once_cell", 165 184 "rustversion", 166 185 "wasm-bindgen-macro", ··· 187 206 source = "registry+https://github.com/rust-lang/crates.io-index" 188 207 checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" 189 208 dependencies = [ 190 - "cfg-if", 209 + "cfg-if 1.0.3", 191 210 "js-sys", 192 211 "once_cell", 193 212 "wasm-bindgen", ··· 261 280 ] 262 281 263 282 [[package]] 283 + name = "wee_alloc" 284 + version = "0.4.5" 285 + source = "registry+https://github.com/rust-lang/crates.io-index" 286 + checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" 287 + dependencies = [ 288 + "cfg-if 0.1.10", 289 + "libc", 290 + "memory_units", 291 + "winapi", 292 + ] 293 + 294 + [[package]] 295 + name = "winapi" 296 + version = "0.3.9" 297 + source = "registry+https://github.com/rust-lang/crates.io-index" 298 + checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 299 + dependencies = [ 300 + "winapi-i686-pc-windows-gnu", 301 + "winapi-x86_64-pc-windows-gnu", 302 + ] 303 + 304 + [[package]] 305 + name = "winapi-i686-pc-windows-gnu" 306 + version = "0.4.0" 307 + source = "registry+https://github.com/rust-lang/crates.io-index" 308 + checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 309 + 310 + [[package]] 264 311 name = "winapi-util" 265 312 version = "0.1.11" 266 313 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 268 315 dependencies = [ 269 316 "windows-sys", 270 317 ] 318 + 319 + [[package]] 320 + name = "winapi-x86_64-pc-windows-gnu" 321 + version = "0.4.0" 322 + source = "registry+https://github.com/rust-lang/crates.io-index" 323 + checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 271 324 272 325 [[package]] 273 326 name = "windows-link"
+3
Cargo.toml
··· 4 4 5 5 [profile.release] 6 6 opt-level = "s" 7 + panic = "abort" 8 + lto = true 9 + codegen-units = 1
+1
com-gm112-rust-testlibrary/Cargo.toml
··· 13 13 [dependencies] 14 14 console_error_panic_hook = { version = "0.1.7", optional = true } 15 15 wasm-bindgen = "0.2.104" 16 + wee_alloc = "0.4.5" 16 17 17 18 [dev-dependencies] 18 19 wasm-bindgen-test = "0.3.54"
+3
com-gm112-rust-testlibrary/README.md
··· 1 + # com-gm112-rust-testlibrary 2 + 3 + This is a test library for Rust. It is configured to be a hybrid type of library, so it includes rlib and cdylib targets, meaning its kind of big in file size initially.
+11
com-gm112-rust-testlibrary/src/lib.rs
··· 1 1 use wasm_bindgen::prelude::*; 2 + use wee_alloc::WeeAlloc; 3 + 4 + #[global_allocator] 5 + static ALLOC: WeeAlloc = WeeAlloc::INIT; 6 + 7 + #[cfg(feature = "console_error_panic_hook")] 8 + #[wasm_bindgen(start)] 9 + pub fn set_panic_hook() { 10 + console_error_panic_hook::set_once(); 11 + } 12 + 2 13 /// Adds two numbers. 3 14 /// 4 15 /// @example <caption>Add two numbers in Rust</caption>