From 754e97300990e3e7d3e4bfd305f3e90b677751c2 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 13 Jul 2023 09:57:34 -0700 Subject: [PATCH] Begin MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On dashes vs. underscores in crate names: The Rust Book says dashes: "$ cargo new my-project" https://doc.rust-lang.org/book/ch07-01-packages-and-crates.html Rust RFC 430 says underscores: "Crates: snake_case (but prefer single word)" https://github.com/rust-lang/rfcs/blob/master/text/0430-finalizing-naming-conventions.md Rust API Guidelines says ¯\_(ツ)_/¯: "Crates: unclear" https://rust-lang.github.io/api-guidelines/naming.html with a link to https://github.com/rust-lang/api-guidelines/issues/29 So I guess we're going with dashes. --- .gitignore | 2 ++ Cargo.toml | 11 +++++++++++ src/lib.rs | 14 ++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..73f846f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "pluta-lesnura" +version = "0.1.0" +edition = "2021" +authors = ["Scott Worley "] +description = "A cooperative game of AI notkilleveryoneism" +license = "AGPL-3.0" +repository = "https://git.scottworley.com/pluta-lesnura" + + +[dependencies] diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/src/lib.rs @@ -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); + } +} -- 2.44.1