utils: Create crate

This commit is contained in:
Steffo 2024-12-18 13:25:49 +01:00
parent 81fdba7e57
commit f9daa6afee
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
4 changed files with 36 additions and 1 deletions

View file

@ -12,6 +12,7 @@
<sourceFolder url="file://$MODULE_DIR$/acrate_mime/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/acrate_mime/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/acrate_rdserver/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/acrate_rdserver/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/acrate_database/tests" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/acrate_database/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/acrate_utils/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />

View file

@ -1,3 +1,3 @@
[workspace] [workspace]
resolver = "2" resolver = "2"
members = ["acrate_database", "acrate_rd", "acrate_nodeinfo", "acrate_rdserver"] members = ["acrate_database", "acrate_rd", "acrate_nodeinfo", "acrate_rdserver", "acrate_utils"]

20
acrate_utils/Cargo.toml Normal file
View file

@ -0,0 +1,20 @@
[package]
name = "acrate_utils"
version = "0.3.0"
authors = ["Stefano Pigozzi <me@steffo.eu>"]
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"

14
acrate_utils/src/lib.rs Normal file
View file

@ -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);
}
}