1
Fork 0

added bare rust project

This commit is contained in:
Andy Killorin 2023-08-25 18:07:24 -05:00
parent 5572faaba4
commit 822cef9916
Signed by: ank
GPG key ID: B6241CA3B552BCA4
5 changed files with 38 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
pirates/target

7
justfile Normal file
View file

@ -0,0 +1,7 @@
build-rust:
cargo build --manifest-path pirates/Cargo.toml --target wasm32-unknown-unknown --release
minify-rust: build-rust
wasm-strip pirates/target/wasm32-unknown-unknown/release/pirates.wasm
wasm-opt -o pirates/target/wasm32-unknown-unknown/release/pirates-opt.wasm -Oz pirates/target/wasm32-unknown-unknown/release/pirates.wasm

7
pirates/Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "pirates"
version = "0.1.0"

9
pirates/Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "pirates"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
[dependencies]

14
pirates/src/lib.rs Normal file
View file

@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}