From e6817f221bb18d0604ff44ec13671d793469a90c Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Sat, 17 Feb 2024 14:26:44 +0100 Subject: [PATCH] Update a few dependencies --- Cargo.lock | 97 ++++++++++++--------------- Cargo.toml | 26 +++---- crates/eww/Cargo.toml | 2 +- crates/eww/src/config/system_stats.rs | 47 +++++++------ 4 files changed, 82 insertions(+), 90 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 016cd10..af8bf70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,6 +47,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -125,23 +131,6 @@ dependencies = [ "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]] name = "atk" version = "0.17.1" @@ -237,30 +226,25 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cached" -version = "0.42.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5877db5d1af7fae60d06b5db9430b68056a69b3582a0be8e3691e87654aeb6" +checksum = "355face540df58778b96814c48abb3c2ed67c4878a8087ab1819c1fedeec505f" dependencies = [ - "async-trait", - "async_once", + "ahash 0.8.8", "cached_proc_macro", "cached_proc_macro_types", - "futures", - "hashbrown 0.13.2", + "hashbrown 0.14.3", "instant", - "lazy_static", "once_cell", "thiserror", - "tokio", ] [[package]] name = "cached_proc_macro" -version = "0.16.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10ca87c81aaa3a949dbbe2b5e6c2c45dbc94ba4897e45ea31ff9ec5087be3dc" +checksum = "9d52f526f7cbc875b296856ca8c964a9f6290556922c303a8a3883e3c676e6a1" dependencies = [ - "cached_proc_macro_types", "darling", "proc-macro2", "quote", @@ -662,7 +646,7 @@ dependencies = [ "libc", "log", "maplit", - "nix 0.26.4", + "nix 0.27.1", "notify", "once_cell", "pretty_env_logger", @@ -1163,6 +1147,10 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.8", + "allocator-api2", +] [[package]] name = "heck" @@ -1479,15 +1467,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.0" @@ -1539,15 +1518,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.26.4" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "cfg-if", "libc", - "memoffset 0.7.1", - "pin-utils", ] [[package]] @@ -2079,7 +2056,7 @@ dependencies = [ "serde", "serde_json", "static_assertions", - "strsim 0.10.0", + "strsim 0.11.0", "strum", "thiserror", ] @@ -2107,13 +2084,13 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smart-default" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" +checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.49", ] [[package]] @@ -2159,24 +2136,24 @@ checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.49", ] [[package]] @@ -2203,9 +2180,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.11" +version = "0.30.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" +checksum = "1fb4f3438c8f6389c864e61221cbc97e9bca98b4daf39a5beb7bea660f528bb2" dependencies = [ "cfg-if", "core-foundation-sys", @@ -2213,7 +2190,7 @@ dependencies = [ "ntapi", "once_cell", "rayon", - "winapi", + "windows", ] [[package]] @@ -2533,6 +2510,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "windows-core" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index 545e59e..f8dabf2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,10 +10,10 @@ yuck = { version = "0.1.0", path = "crates/yuck", default-features = false} anyhow = "1.0.79" bincode = "1.3.3" -cached = "0.42.0" +cached = "0.48.0" chrono = "0.4.26" chrono-tz = "0.8.2" -clap = {version = "4.3.21", features = ["derive"] } +clap = {version = "4.5.1", features = ["derive"] } codespan-reporting = "0.11" derive_more = "0.99" extend = "1.2" @@ -28,24 +28,24 @@ lalrpop-util = "0.19.5" libc = "0.2" log = "0.4" maplit = "1" -nix = "0.26.2" -notify = "6.0.1" -once_cell = "1.18" -pretty_assertions = "1.2" -pretty_env_logger = "0.5" +nix = "0.27.1" +notify = "6.1.1" +once_cell = "1.19" +pretty_assertions = "1.4.0" +pretty_env_logger = "0.5.0" ref-cast = "1.0.22" regex = "1.10.3" serde_json = "1.0" serde = {version = "1.0", features = ["derive"]} simple-signal = "1.1" -smart-default = "0.6" -static_assertions = "1.1" -strsim = "0.10" -strum = { version = "0.24", features = ["derive"] } -sysinfo = "0.29.8" +smart-default = "0.7.1" +static_assertions = "1.1.0" +strsim = "0.11" +strum = { version = "0.26", features = ["derive"] } +sysinfo = "0.30.5" thiserror = "1.0" tokio-util = "0.7.8" -tokio = { version = "1.31.0", features = ["full"] } +tokio = { version = "1.36.0", features = ["full"] } unescape = "0.1" wait-timeout = "0.2" diff --git a/crates/eww/Cargo.toml b/crates/eww/Cargo.toml index d30541a..0552276 100644 --- a/crates/eww/Cargo.toml +++ b/crates/eww/Cargo.toml @@ -47,7 +47,7 @@ itertools.workspace = true libc.workspace = true log.workspace = true maplit.workspace = true -nix.workspace = true +nix = { workspace = true, features = ["process", "fs", "signal"] } notify.workspace = true once_cell.workspace = true pretty_env_logger.workspace = true diff --git a/crates/eww/src/config/system_stats.rs b/crates/eww/src/config/system_stats.rs index 3401c06..18b5d29 100644 --- a/crates/eww/src/config/system_stats.rs +++ b/crates/eww/src/config/system_stats.rs @@ -3,17 +3,21 @@ use anyhow::{Context, Result}; use itertools::Itertools; use once_cell::sync::Lazy; use std::{fs::read_to_string, sync::Mutex}; -use sysinfo::{ComponentExt, CpuExt, DiskExt, NetworkExt, NetworksExt, System, SystemExt}; +use sysinfo::System; static SYSTEM: Lazy> = Lazy::new(|| Mutex::new(System::new())); +static DISKS: Lazy> = Lazy::new(|| Mutex::new(sysinfo::Disks::new())); +static COMPONENTS: Lazy> = Lazy::new(|| Mutex::new(sysinfo::Components::new())); +static NETWORKS: Lazy> = Lazy::new(|| Mutex::new(sysinfo::Networks::new())); pub fn get_disks() -> String { - let mut c = SYSTEM.lock().unwrap(); - c.refresh_disks_list(); + let mut disks = DISKS.lock().unwrap(); + disks.refresh_list(); + disks.refresh(); format!( "{{ {} }}", - c.disks() + disks .iter() .map(|c| { let total_space = c.total_space(); @@ -34,18 +38,18 @@ pub fn get_disks() -> String { } pub fn get_ram() -> String { - let mut c = SYSTEM.lock().unwrap(); - c.refresh_memory(); + let mut system = SYSTEM.lock().unwrap(); + system.refresh_memory(); - let total_memory = c.total_memory(); - let available_memory = c.available_memory(); + let total_memory = system.total_memory(); + let available_memory = system.available_memory(); let used_memory = total_memory as f32 - available_memory as f32; format!( r#"{{"total_mem": {}, "free_mem": {}, "total_swap": {}, "free_swap": {}, "available_mem": {}, "used_mem": {}, "used_mem_perc": {}}}"#, total_memory, - c.free_memory(), - c.total_swap(), - c.free_swap(), + system.free_memory(), + system.total_swap(), + system.free_swap(), available_memory, used_memory, (used_memory / total_memory as f32) * 100f32, @@ -53,12 +57,12 @@ pub fn get_ram() -> String { } pub fn get_temperatures() -> String { - let mut c = SYSTEM.lock().unwrap(); - c.refresh_components_list(); - c.refresh_components(); + let mut components = COMPONENTS.lock().unwrap(); + components.refresh_list(); + components.refresh(); format!( "{{ {} }}", - c.components() + components .iter() .map(|c| format!( r#""{}": {}"#, @@ -72,9 +76,9 @@ pub fn get_temperatures() -> String { } pub fn get_cpus() -> String { - let mut c = SYSTEM.lock().unwrap(); - c.refresh_cpu_specifics(sysinfo::CpuRefreshKind::everything()); - let cpus = c.cpus(); + let mut system = SYSTEM.lock().unwrap(); + system.refresh_cpu_specifics(sysinfo::CpuRefreshKind::everything()); + let cpus = system.cpus(); let json = serde_json::json!({ "cores": cpus.iter() .map(|a| { @@ -192,11 +196,12 @@ pub fn get_battery_capacity() -> Result { } pub fn net() -> String { - let mut c = SYSTEM.lock().unwrap(); - c.refresh_networks_list(); + let mut networks = NETWORKS.lock().unwrap(); + networks.refresh_list(); + networks.refresh(); let interfaces = format!( "{{ {} }}", - &c.networks() + &networks .iter() .map(|a| format!(r#""{}": {{ "NET_UP": {}, "NET_DOWN": {} }}"#, a.0, a.1.transmitted(), a.1.received())) .join(","),