Update a few dependencies

This commit is contained in:
elkowar 2024-02-17 14:26:44 +01:00
parent 42f3410b5b
commit e6817f221b
No known key found for this signature in database
GPG key ID: 862BA3D7D7760F13
4 changed files with 82 additions and 90 deletions

97
Cargo.lock generated
View file

@ -47,6 +47,12 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "allocator-api2"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]] [[package]]
name = "android-tzdata" name = "android-tzdata"
version = "0.1.1" version = "0.1.1"
@ -125,23 +131,6 @@ dependencies = [
"term", "term",
] ]
[[package]]
name = "async-trait"
version = "0.1.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.49",
]
[[package]]
name = "async_once"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ce4f10ea3abcd6617873bae9f91d1c5332b4a778bd9ce34d0cd517474c1de82"
[[package]] [[package]]
name = "atk" name = "atk"
version = "0.17.1" version = "0.17.1"
@ -237,30 +226,25 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]] [[package]]
name = "cached" name = "cached"
version = "0.42.0" version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e5877db5d1af7fae60d06b5db9430b68056a69b3582a0be8e3691e87654aeb6" checksum = "355face540df58778b96814c48abb3c2ed67c4878a8087ab1819c1fedeec505f"
dependencies = [ dependencies = [
"async-trait", "ahash 0.8.8",
"async_once",
"cached_proc_macro", "cached_proc_macro",
"cached_proc_macro_types", "cached_proc_macro_types",
"futures", "hashbrown 0.14.3",
"hashbrown 0.13.2",
"instant", "instant",
"lazy_static",
"once_cell", "once_cell",
"thiserror", "thiserror",
"tokio",
] ]
[[package]] [[package]]
name = "cached_proc_macro" name = "cached_proc_macro"
version = "0.16.0" version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e10ca87c81aaa3a949dbbe2b5e6c2c45dbc94ba4897e45ea31ff9ec5087be3dc" checksum = "9d52f526f7cbc875b296856ca8c964a9f6290556922c303a8a3883e3c676e6a1"
dependencies = [ dependencies = [
"cached_proc_macro_types",
"darling", "darling",
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -662,7 +646,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"maplit", "maplit",
"nix 0.26.4", "nix 0.27.1",
"notify", "notify",
"once_cell", "once_cell",
"pretty_env_logger", "pretty_env_logger",
@ -1163,6 +1147,10 @@ name = "hashbrown"
version = "0.14.3" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash 0.8.8",
"allocator-api2",
]
[[package]] [[package]]
name = "heck" name = "heck"
@ -1479,15 +1467,6 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "memoffset" name = "memoffset"
version = "0.9.0" version = "0.9.0"
@ -1539,15 +1518,13 @@ dependencies = [
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.26.4" version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.4.2",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset 0.7.1",
"pin-utils",
] ]
[[package]] [[package]]
@ -2079,7 +2056,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"static_assertions", "static_assertions",
"strsim 0.10.0", "strsim 0.11.0",
"strum", "strum",
"thiserror", "thiserror",
] ]
@ -2107,13 +2084,13 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]] [[package]]
name = "smart-default" name = "smart-default"
version = "0.6.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 2.0.49",
] ]
[[package]] [[package]]
@ -2159,24 +2136,24 @@ checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.24.1" version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f"
dependencies = [ dependencies = [
"strum_macros", "strum_macros",
] ]
[[package]] [[package]]
name = "strum_macros" name = "strum_macros"
version = "0.24.3" version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 1.0.109", "syn 2.0.49",
] ]
[[package]] [[package]]
@ -2203,9 +2180,9 @@ dependencies = [
[[package]] [[package]]
name = "sysinfo" name = "sysinfo"
version = "0.29.11" version = "0.30.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" checksum = "1fb4f3438c8f6389c864e61221cbc97e9bca98b4daf39a5beb7bea660f528bb2"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"core-foundation-sys", "core-foundation-sys",
@ -2213,7 +2190,7 @@ dependencies = [
"ntapi", "ntapi",
"once_cell", "once_cell",
"rayon", "rayon",
"winapi", "windows",
] ]
[[package]] [[package]]
@ -2533,6 +2510,16 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-targets 0.52.0",
]
[[package]] [[package]]
name = "windows-core" name = "windows-core"
version = "0.52.0" version = "0.52.0"

View file

@ -10,10 +10,10 @@ yuck = { version = "0.1.0", path = "crates/yuck", default-features = false}
anyhow = "1.0.79" anyhow = "1.0.79"
bincode = "1.3.3" bincode = "1.3.3"
cached = "0.42.0" cached = "0.48.0"
chrono = "0.4.26" chrono = "0.4.26"
chrono-tz = "0.8.2" chrono-tz = "0.8.2"
clap = {version = "4.3.21", features = ["derive"] } clap = {version = "4.5.1", features = ["derive"] }
codespan-reporting = "0.11" codespan-reporting = "0.11"
derive_more = "0.99" derive_more = "0.99"
extend = "1.2" extend = "1.2"
@ -28,24 +28,24 @@ lalrpop-util = "0.19.5"
libc = "0.2" libc = "0.2"
log = "0.4" log = "0.4"
maplit = "1" maplit = "1"
nix = "0.26.2" nix = "0.27.1"
notify = "6.0.1" notify = "6.1.1"
once_cell = "1.18" once_cell = "1.19"
pretty_assertions = "1.2" pretty_assertions = "1.4.0"
pretty_env_logger = "0.5" pretty_env_logger = "0.5.0"
ref-cast = "1.0.22" ref-cast = "1.0.22"
regex = "1.10.3" regex = "1.10.3"
serde_json = "1.0" serde_json = "1.0"
serde = {version = "1.0", features = ["derive"]} serde = {version = "1.0", features = ["derive"]}
simple-signal = "1.1" simple-signal = "1.1"
smart-default = "0.6" smart-default = "0.7.1"
static_assertions = "1.1" static_assertions = "1.1.0"
strsim = "0.10" strsim = "0.11"
strum = { version = "0.24", features = ["derive"] } strum = { version = "0.26", features = ["derive"] }
sysinfo = "0.29.8" sysinfo = "0.30.5"
thiserror = "1.0" thiserror = "1.0"
tokio-util = "0.7.8" tokio-util = "0.7.8"
tokio = { version = "1.31.0", features = ["full"] } tokio = { version = "1.36.0", features = ["full"] }
unescape = "0.1" unescape = "0.1"
wait-timeout = "0.2" wait-timeout = "0.2"

View file

@ -47,7 +47,7 @@ itertools.workspace = true
libc.workspace = true libc.workspace = true
log.workspace = true log.workspace = true
maplit.workspace = true maplit.workspace = true
nix.workspace = true nix = { workspace = true, features = ["process", "fs", "signal"] }
notify.workspace = true notify.workspace = true
once_cell.workspace = true once_cell.workspace = true
pretty_env_logger.workspace = true pretty_env_logger.workspace = true

View file

@ -3,17 +3,21 @@ use anyhow::{Context, Result};
use itertools::Itertools; use itertools::Itertools;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::{fs::read_to_string, sync::Mutex}; use std::{fs::read_to_string, sync::Mutex};
use sysinfo::{ComponentExt, CpuExt, DiskExt, NetworkExt, NetworksExt, System, SystemExt}; use sysinfo::System;
static SYSTEM: Lazy<Mutex<System>> = Lazy::new(|| Mutex::new(System::new())); static SYSTEM: Lazy<Mutex<System>> = Lazy::new(|| Mutex::new(System::new()));
static DISKS: Lazy<Mutex<sysinfo::Disks>> = Lazy::new(|| Mutex::new(sysinfo::Disks::new()));
static COMPONENTS: Lazy<Mutex<sysinfo::Components>> = Lazy::new(|| Mutex::new(sysinfo::Components::new()));
static NETWORKS: Lazy<Mutex<sysinfo::Networks>> = Lazy::new(|| Mutex::new(sysinfo::Networks::new()));
pub fn get_disks() -> String { pub fn get_disks() -> String {
let mut c = SYSTEM.lock().unwrap(); let mut disks = DISKS.lock().unwrap();
c.refresh_disks_list(); disks.refresh_list();
disks.refresh();
format!( format!(
"{{ {} }}", "{{ {} }}",
c.disks() disks
.iter() .iter()
.map(|c| { .map(|c| {
let total_space = c.total_space(); let total_space = c.total_space();
@ -34,18 +38,18 @@ pub fn get_disks() -> String {
} }
pub fn get_ram() -> String { pub fn get_ram() -> String {
let mut c = SYSTEM.lock().unwrap(); let mut system = SYSTEM.lock().unwrap();
c.refresh_memory(); system.refresh_memory();
let total_memory = c.total_memory(); let total_memory = system.total_memory();
let available_memory = c.available_memory(); let available_memory = system.available_memory();
let used_memory = total_memory as f32 - available_memory as f32; let used_memory = total_memory as f32 - available_memory as f32;
format!( format!(
r#"{{"total_mem": {}, "free_mem": {}, "total_swap": {}, "free_swap": {}, "available_mem": {}, "used_mem": {}, "used_mem_perc": {}}}"#, r#"{{"total_mem": {}, "free_mem": {}, "total_swap": {}, "free_swap": {}, "available_mem": {}, "used_mem": {}, "used_mem_perc": {}}}"#,
total_memory, total_memory,
c.free_memory(), system.free_memory(),
c.total_swap(), system.total_swap(),
c.free_swap(), system.free_swap(),
available_memory, available_memory,
used_memory, used_memory,
(used_memory / total_memory as f32) * 100f32, (used_memory / total_memory as f32) * 100f32,
@ -53,12 +57,12 @@ pub fn get_ram() -> String {
} }
pub fn get_temperatures() -> String { pub fn get_temperatures() -> String {
let mut c = SYSTEM.lock().unwrap(); let mut components = COMPONENTS.lock().unwrap();
c.refresh_components_list(); components.refresh_list();
c.refresh_components(); components.refresh();
format!( format!(
"{{ {} }}", "{{ {} }}",
c.components() components
.iter() .iter()
.map(|c| format!( .map(|c| format!(
r#""{}": {}"#, r#""{}": {}"#,
@ -72,9 +76,9 @@ pub fn get_temperatures() -> String {
} }
pub fn get_cpus() -> String { pub fn get_cpus() -> String {
let mut c = SYSTEM.lock().unwrap(); let mut system = SYSTEM.lock().unwrap();
c.refresh_cpu_specifics(sysinfo::CpuRefreshKind::everything()); system.refresh_cpu_specifics(sysinfo::CpuRefreshKind::everything());
let cpus = c.cpus(); let cpus = system.cpus();
let json = serde_json::json!({ let json = serde_json::json!({
"cores": cpus.iter() "cores": cpus.iter()
.map(|a| { .map(|a| {
@ -192,11 +196,12 @@ pub fn get_battery_capacity() -> Result<String> {
} }
pub fn net() -> String { pub fn net() -> String {
let mut c = SYSTEM.lock().unwrap(); let mut networks = NETWORKS.lock().unwrap();
c.refresh_networks_list(); networks.refresh_list();
networks.refresh();
let interfaces = format!( let interfaces = format!(
"{{ {} }}", "{{ {} }}",
&c.networks() &networks
.iter() .iter()
.map(|a| format!(r#""{}": {{ "NET_UP": {}, "NET_DOWN": {} }}"#, a.0, a.1.transmitted(), a.1.received())) .map(|a| format!(r#""{}": {{ "NET_UP": {}, "NET_DOWN": {} }}"#, a.0, a.1.transmitted(), a.1.received()))
.join(","), .join(","),