From f9daa6afee057327142fbb9e0394c362f3e4f1c4 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 18 Dec 2024 13:25:49 +0100 Subject: [PATCH] `utils`: Create crate --- .idea/acrate.iml | 1 + Cargo.toml | 2 +- acrate_utils/Cargo.toml | 20 ++++++++++++++++++++ acrate_utils/src/lib.rs | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 acrate_utils/Cargo.toml create mode 100644 acrate_utils/src/lib.rs diff --git a/.idea/acrate.iml b/.idea/acrate.iml index 8ef4dcf..01a6e70 100644 --- a/.idea/acrate.iml +++ b/.idea/acrate.iml @@ -12,6 +12,7 @@ + diff --git a/Cargo.toml b/Cargo.toml index d528923..1e44dab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] resolver = "2" -members = ["acrate_database", "acrate_rd", "acrate_nodeinfo", "acrate_rdserver"] +members = ["acrate_database", "acrate_rd", "acrate_nodeinfo", "acrate_rdserver", "acrate_utils"] diff --git a/acrate_utils/Cargo.toml b/acrate_utils/Cargo.toml new file mode 100644 index 0000000..099c1d6 --- /dev/null +++ b/acrate_utils/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "acrate_utils" +version = "0.3.0" +authors = ["Stefano Pigozzi "] +edition = "2021" +description = "Utilities for the acrate project" +repository = "https://forge.steffo.eu/unimore/tirocinio-canali-steffo-acrate" +license = "EUPL-1.2" +keywords = [] +categories = [] + +[dependencies] +axum = { version = "0.7.7", features = ["macros"] } +axum-extra = { version = "0.9.4", features = ["query"] } +log = { version = "0.4.22", features = ["std", "max_level_trace", "release_max_level_debug"] } +pretty_env_logger = "0.5.0" +mediatype = { version = "0.19.18", features = ["serde"] } + +[lints.clippy] +tabs-in-doc-comments = "allow" diff --git a/acrate_utils/src/lib.rs b/acrate_utils/src/lib.rs new file mode 100644 index 0000000..b93cf3f --- /dev/null +++ b/acrate_utils/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +}