From 62f0fa71cb47a76859804a59400a013a48d95ed4 Mon Sep 17 00:00:00 2001 From: David Skrundz Date: Fri, 22 Dec 2023 23:21:13 -0700 Subject: [PATCH] Initial commit --- .gitignore | 9 +++++++++ .rustfmt.toml | 2 ++ .vscode/extensions.json | 10 ++++++++++ .vscode/settings.json | 32 ++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 6 ++++++ Cargo.toml | 20 ++++++++++++++++++++ LICENSE.md | 7 +++++++ README.md | 3 +++ rust-toolchain.toml | 2 ++ rust/Cargo.toml | 14 ++++++++++++++ rust/src/lib.rs | 14 ++++++++++++++ 11 files changed, 119 insertions(+) create mode 100644 .gitignore create mode 100644 .rustfmt.toml create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 CONTRIBUTING.md create mode 100644 Cargo.toml create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 rust-toolchain.toml create mode 100644 rust/Cargo.toml create mode 100644 rust/src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8dfb24 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# OS Files +*~ +._* +.DS_Store + +# Rust +/target +# Rust Libraries Only +/Cargo.lock diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..5e7f9e2 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,2 @@ +hard_tabs = true +wrap_comments = true diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..bf12d09 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + "recommendations": [ + "vadimcn.vscode-lldb", + "barbosshack.crates-io", + "usernamehw.errorlens", + "tamasfe.even-better-toml", + "rust-lang.rust-analyzer", + "karunamurti.tera", // Tera templates + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..dd429e9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,32 @@ +{ + // VSCode + "editor.detectIndentation": false, + "editor.insertSpaces": false, + "editor.tabSize": 4, + "files.exclude": { + "**/target": true, + "**/Cargo.lock": true, + }, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "files.watcherExclude": { + "**/.git/**": true, + "**/target/**": true, + }, + // Extensions + "crates.listPreReleases": true, + "evenBetterToml.formatter.alignComments": true, + "evenBetterToml.formatter.alignEntries": false, + "evenBetterToml.formatter.allowedBlankLines": 1, + "evenBetterToml.formatter.arrayAutoExpand": true, + "evenBetterToml.formatter.arrayTrailingComma": true, + "evenBetterToml.formatter.columnWidth": 80, + "evenBetterToml.formatter.reorderKeys": true, + "evenBetterToml.formatter.trailingNewline": true, + "rust-analyzer.imports.granularity.enforce": true, + "rust-analyzer.imports.granularity.group": "module", + "rust-analyzer.imports.group.enable": true, + "rust-analyzer.imports.merge.glob": false, + "rust-analyzer.imports.preferNoStd": true, +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2f4b83c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,6 @@ +How to Contribute +================= + +We'd love to accept your patches and contributions to this project. +We just need you to follow the Contributor License Agreement outlined +in the latest v0.0.x of https://github.com/Skrunix/license diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..67562e7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,20 @@ +[workspace] +members = ["rust"] +resolver = "2" + +[workspace.package] +authors = [] +edition = "2021" +license-file = "LICENSE.md" +rust-version = "1.64.0" + +[workspace.lints.rust] +unsafe_code = "forbid" + +[profile.release] +lto = "fat" +opt-level = 3 +strip = "debuginfo" + +[workspace.dependencies] +# crate = { version = "^0", default-features = false } diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..161d3b0 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,7 @@ +Skrunix Software License +======================== + +Permission to use, copy, modify, and/or distribute this software is +outlined in the latest v0.0.x of https://github.com/Skrunix/license + +THE SOFTWARE IS PROVIDED "AS IS" diff --git a/README.md b/README.md new file mode 100644 index 0000000..76a6cd4 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Workspace Template + +Make sure not to keep git history when copying this template diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable" diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..08397b7 --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "rust" +version = "0.0.0" + +authors.workspace = true +edition.workspace = true +license-file.workspace = true +rust-version.workspace = true + +[lints] +workspace = true + +[dependencies] +# crate = { workspace = true } diff --git a/rust/src/lib.rs b/rust/src/lib.rs new file mode 100644 index 0000000..06d268d --- /dev/null +++ b/rust/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); + } +}