]> git.scottworley.com Git - pluta-lesnura/commitdiff
Begin
authorScott Worley <scottworley@scottworley.com>
Thu, 13 Jul 2023 16:57:34 +0000 (09:57 -0700)
committerScott Worley <scottworley@scottworley.com>
Thu, 13 Jul 2023 17:02:46 +0000 (10:02 -0700)
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 [new file with mode: 0644]
Cargo.toml [new file with mode: 0644]
src/lib.rs [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..4fffb2f
--- /dev/null
@@ -0,0 +1,2 @@
+/target
+/Cargo.lock
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644 (file)
index 0000000..73f846f
--- /dev/null
@@ -0,0 +1,11 @@
+[package]
+name = "pluta-lesnura"
+version = "0.1.0"
+edition = "2021"
+authors = ["Scott Worley <scottworley@scottworley.com>"]
+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 (file)
index 0000000..7d12d9a
--- /dev/null
@@ -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);
+    }
+}