From 8df05bb42392abfd1a76db2f5b1d84b845ab44ad Mon Sep 17 00:00:00 2001 From: Jorge Bolois Date: Sat, 3 Feb 2024 12:42:56 +0100 Subject: [PATCH] adding lib files --- Cargo.lock | 2 +- Cargo.toml | 8 +++++++- src/lib.rs | 6 ++++++ src/lm_sensors.rs | 7 +++---- 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index f52a5a3..c883338 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -87,7 +87,7 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "mtemp" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "serde", diff --git a/Cargo.toml b/Cargo.toml index 45c32b4..16f1ad6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,13 @@ readme = "README.md" keywords = ["temperature", "cli", "nvidia", "amd"] categories = ["command-line-utilities"] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +name = "mtemp" +crate-type = ["lib"] + +[[bin]] +name = "mtemp" +path = "src/main.rs" [dependencies] anyhow = "1.0.79" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..0b4c591 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,6 @@ +mod lm_sensors; +mod mtemp; +mod nvidia_smi; +mod sensor_names; + +pub use mtemp::Mtemp; diff --git a/src/lm_sensors.rs b/src/lm_sensors.rs index 405db97..3b3a930 100644 --- a/src/lm_sensors.rs +++ b/src/lm_sensors.rs @@ -1,3 +1,6 @@ +use crate::sensor_names::CPU_NAMES; +use crate::sensor_names::DISK_NAMES; +use crate::sensor_names::TEMP_NAMES; use anyhow::anyhow; use anyhow::Result; use core::f64; @@ -5,10 +8,6 @@ use serde::Deserialize; use std::collections::BTreeMap; use std::process::Command; -use crate::sensor_names::CPU_NAMES; -use crate::sensor_names::DISK_NAMES; -use crate::sensor_names::TEMP_NAMES; - #[derive(Debug)] pub struct SensorData { chips: BTreeMap,