adding lib files

This commit is contained in:
Jorge Bolois 2024-02-03 12:42:56 +01:00
parent 2cedbf30e4
commit 8df05bb423
4 changed files with 17 additions and 6 deletions

2
Cargo.lock generated
View File

@ -87,7 +87,7 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]] [[package]]
name = "mtemp" name = "mtemp"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",

View File

@ -10,7 +10,13 @@ readme = "README.md"
keywords = ["temperature", "cli", "nvidia", "amd"] keywords = ["temperature", "cli", "nvidia", "amd"]
categories = ["command-line-utilities"] 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] [dependencies]
anyhow = "1.0.79" anyhow = "1.0.79"

6
src/lib.rs Normal file
View File

@ -0,0 +1,6 @@
mod lm_sensors;
mod mtemp;
mod nvidia_smi;
mod sensor_names;
pub use mtemp::Mtemp;

View File

@ -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::anyhow;
use anyhow::Result; use anyhow::Result;
use core::f64; use core::f64;
@ -5,10 +8,6 @@ use serde::Deserialize;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::process::Command; use std::process::Command;
use crate::sensor_names::CPU_NAMES;
use crate::sensor_names::DISK_NAMES;
use crate::sensor_names::TEMP_NAMES;
#[derive(Debug)] #[derive(Debug)]
pub struct SensorData { pub struct SensorData {
chips: BTreeMap<String, Sensor>, chips: BTreeMap<String, Sensor>,