From b57c6d6c103d9952c6a9c4ef9f57b95ba66bcb66 Mon Sep 17 00:00:00 2001 From: Alex Rodriguez <76191391+ARod76@users.noreply.github.com> Date: Fri, 26 Jun 2026 22:23:23 -0700 Subject: [PATCH 1/3] Add rust_demo initial Cargo project Scaffolded with cargo new; builds and runs the default Hello World binary. Co-Authored-By: Oz --- rust_demo/Cargo.lock | 7 +++++++ rust_demo/Cargo.toml | 6 ++++++ rust_demo/src/main.rs | 3 +++ 3 files changed, 16 insertions(+) create mode 100644 rust_demo/Cargo.lock create mode 100644 rust_demo/Cargo.toml create mode 100644 rust_demo/src/main.rs diff --git a/rust_demo/Cargo.lock b/rust_demo/Cargo.lock new file mode 100644 index 000000000..73675b54c --- /dev/null +++ b/rust_demo/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "rust_demo" +version = "0.1.0" diff --git a/rust_demo/Cargo.toml b/rust_demo/Cargo.toml new file mode 100644 index 000000000..b0f93f28b --- /dev/null +++ b/rust_demo/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "rust_demo" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/rust_demo/src/main.rs b/rust_demo/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/rust_demo/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} From 371f2622c5fef19871072d2072f1b5439449afb8 Mon Sep 17 00:00:00 2001 From: Alex Rodriguez <76191391+ARod76@users.noreply.github.com> Date: Fri, 26 Jun 2026 22:25:26 -0700 Subject: [PATCH 2/3] Add project-local .gitignore for rust_demo Ignore the Cargo build output directory (/target). Co-Authored-By: Oz --- rust_demo/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 rust_demo/.gitignore diff --git a/rust_demo/.gitignore b/rust_demo/.gitignore new file mode 100644 index 000000000..ea8c4bf7f --- /dev/null +++ b/rust_demo/.gitignore @@ -0,0 +1 @@ +/target From 56bcea935e8637e3a3f17824463bce840b82830d Mon Sep 17 00:00:00 2001 From: Alex Rodriguez <76191391+ARod76@users.noreply.github.com> Date: Fri, 26 Jun 2026 22:28:15 -0700 Subject: [PATCH 3/3] Add add() function and unit test to rust_demo Introduce add(a, b), print a sample sum in main, and add a passing unit test (test_add). Co-Authored-By: Oz --- rust_demo/src/main.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rust_demo/src/main.rs b/rust_demo/src/main.rs index e7a11a969..78853efb1 100644 --- a/rust_demo/src/main.rs +++ b/rust_demo/src/main.rs @@ -1,3 +1,19 @@ +fn add(a: i32, b: i32) -> i32 { + a + b +} + fn main() { println!("Hello, world!"); + println!("2 + 3 = {}", add(2, 3)); +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_add() { + assert_eq!(add(2, 3), 5); + assert_eq!(add(-1, 1), 0); + } }