From 213db5437843b1ce3f8853beeae2de73dc64c778 Mon Sep 17 00:00:00 2001 From: svartalf Date: Wed, 28 Aug 2019 18:53:59 +0300 Subject: [PATCH] Update to heim v0.0.7. --- Cargo.lock | 277 +++++++++++++++++++++++++++------------------ Cargo.toml | 2 +- src/object/dict.rs | 7 ++ src/plugins/sys.rs | 196 ++++++++++++++++++-------------- 4 files changed, 289 insertions(+), 193 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9bc2d8855b..69b4929885 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -26,7 +26,7 @@ name = "ansi_term" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -59,7 +59,7 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -108,7 +108,7 @@ dependencies = [ "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "uom 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -270,7 +270,7 @@ name = "clipboard-win" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -428,7 +428,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossterm_utils 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossterm_winapi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -440,7 +440,7 @@ dependencies = [ "crossterm_utils 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossterm_winapi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -450,7 +450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossterm_utils 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossterm_winapi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -460,7 +460,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossterm_utils 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "crossterm_winapi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -481,7 +481,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossterm_winapi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -489,7 +489,7 @@ name = "crossterm_winapi" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -527,7 +527,7 @@ version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -557,7 +557,25 @@ dependencies = [ "openssl-sys 0.9.49 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "darwin-libproc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "darwin-libproc-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "darwin-libproc-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -590,7 +608,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -600,7 +618,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -620,7 +638,7 @@ dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -883,163 +901,179 @@ dependencies = [ [[package]] name = "heim" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-cpu 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-disk 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-host 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-memory 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-net 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-process 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-virt 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-cpu 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-disk 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-host 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-memory 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-net 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-process 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-sensors 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-virt 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-common" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.18 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", + "uom 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-cpu" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-derive" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.43 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-disk" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "widestring 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-host" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "platforms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-memory" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-net" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "macaddr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-process" -version = "0.0.6" +version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "darwin-libproc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.18 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-cpu 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-net 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "ntapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heim-runtime" -version = "0.0.2" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.18 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "heim-virt" -version = "0.0.6" +name = "heim-sensors" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heim-virt" +version = "0.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1154,7 +1188,7 @@ dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1455,6 +1489,18 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nix" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.13" @@ -1494,7 +1540,7 @@ name = "ntapi" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1524,7 +1570,7 @@ dependencies = [ "getset 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "heim 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "heim 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.22.1 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1721,7 +1767,7 @@ name = "output_vt100" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1750,7 +1796,7 @@ dependencies = [ "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1930,7 +1976,7 @@ dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1948,7 +1994,7 @@ dependencies = [ "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2033,7 +2079,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2046,7 +2092,7 @@ dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2083,7 +2129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "readkey 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.18.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2167,7 +2213,7 @@ name = "remove_dir_all" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2234,7 +2280,7 @@ dependencies = [ "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2261,7 +2307,7 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2458,7 +2504,7 @@ dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2497,7 +2543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2582,7 +2628,7 @@ dependencies = [ "doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2595,7 +2641,7 @@ dependencies = [ "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2605,7 +2651,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2669,7 +2715,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2777,6 +2823,16 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "uom" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "url" version = "2.1.0" @@ -2836,7 +2892,7 @@ version = "2.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2958,7 +3014,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2980,7 +3036,7 @@ name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2993,7 +3049,7 @@ name = "wincolor" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3002,7 +3058,7 @@ name = "winutil" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3116,6 +3172,8 @@ dependencies = [ "checksum ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7dfd2d8b4c82121dfdff120f818e09fc4380b0b7e17a742081a89b94853e87f" "checksum curl 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)" = "f8ed9a22aa8c4e49ac0c896279ef532a43a7df2f54fcd19fa36960de029f965f" "checksum curl-sys 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "5e90ae10f635645cba9cad1023535f54915a95c58c44751c6ed70dbaeb17a408" +"checksum darwin-libproc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ade5a88af8d9646bf770687321a9488a0f2b4610aa08b0373016cd1af37f0a31" +"checksum darwin-libproc-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c30d1a078d74da1183b02fed8a8b07afc412d3998334b53b750d0ed03b031541" "checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" "checksum derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c3fd04571b29c91cfbe1e7c9a228e069ac8635f180ffb4ccd6a6907617ee8bb0" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" @@ -3154,17 +3212,18 @@ dependencies = [ "checksum git2 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8cb400360e8a4d61b10e648285bbfa919bbf9519d0d5d5720354456f44349226" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum heim 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7a996721efa683319648b170ff0b7f22a7cec42b417f1d1871c229b87a3231e9" -"checksum heim-common 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "61d9e785d002b44e31be34f9956b8c68af12070017a1020db1218e3f870407ae" -"checksum heim-cpu 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f112cb820851d6d24dd77d169bd5c32f8c6588de56bed1b82010ec0dbbe68c62" -"checksum heim-derive 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0f1098f444459eec56e78527ff7f157e3c5e5c2c70c0c4a6ce7dce79fb8a4262" -"checksum heim-disk 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1d4c796b58239602481f3cc7e0695769ef0a2512f0272fd5a42d7f8fb4493e43" -"checksum heim-host 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "87bc31113726eebe29a3b8aa876c322f09208c3d614708f89cea40e50e011c17" -"checksum heim-memory 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bcc41a4d761f8136d661c45c8ad22a6f87900459f84ec2347294fcd568da3f2" -"checksum heim-net 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aa7d8887d3940a30beea92368cf8be3eae0a89e46c80d036e2fd744525150e22" -"checksum heim-process 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5460611f1d0cace5460cbd8c02061927390a41cfeeed68007c794239b5274cd4" -"checksum heim-runtime 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3304dc68b138eb6e9b6c79785dd911306a4bca66757a88373cb034a4dfe3a4d" -"checksum heim-virt 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6f68f73f66e6f00404d7b8ed97b458778f6ccafe1ecd65af797ec36f2003bf90" +"checksum heim 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "4e61bf22465c7f49852fd7e6044a395394962a2eaac0b5c1b87b5b0f010b0f48" +"checksum heim-common 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "81e38b3fc29d7888133d0ada8bc083487386fd930f3c8fd34a528a2aa4352a3a" +"checksum heim-cpu 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "307f12a429cfe56c92413f98a6e1a28f72d715b9f65fbfdf2e98f15bd38293c6" +"checksum heim-derive 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "addd10c94d06b172f816a1969253c2dd8a3f633e165d8e018e0be873d67f8cac" +"checksum heim-disk 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "2ee4860d01ea623512bcd1d2d54e4566d482f2d4568789562b13d4b8cc294f00" +"checksum heim-host 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1c6dee47910be9b5fb323ec6bf7462773a8bee67b65e5fe5d652f3e20b3ecab9" +"checksum heim-memory 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "30f5e88edcafd7ee6061997d171f84c153fabdd6459d739b45d7f05193d7f98c" +"checksum heim-net 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5b265598f9d3ca525f54a394153e3e738af9795ac5be7c364d55a7be857e69" +"checksum heim-process 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "2165577ccfce4d038de4ca66cbb5c226e1691dff62c778cac6717455dc9ef28d" +"checksum heim-runtime 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4c23e20c02d9df62dbed41273e99ad70c9ebd8799f35ac672086f8cc584d09" +"checksum heim-sensors 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e641fab2e31c4b2039451a713dc92a5daacf84c617c803c946b8081fe8132142" +"checksum heim-virt 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "331b1486ed710843c551ac3a8ddb2721dd5345b3939f995ce0dbe453ba901b06" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" "checksum http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "372bcb56f939e449117fb0869c2e8fd8753a8223d92a172c6e808cf123a5b6e4" @@ -3213,6 +3272,7 @@ dependencies = [ "checksum miniz_oxide_c_api 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6c675792957b0d19933816c4e1d56663c341dd9bfa31cb2140ff2267c1d8ecf4" "checksum neso 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3c31defbcb081163db18437fd88c2a267cb3e26f7bd5e4b186e4b1b38fe8c8" "checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "checksum nom 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9761d859320e381010a4f7f8ed425f2c924de33ad121ace447367c713ad561b" @@ -3358,6 +3418,7 @@ dependencies = [ "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum uom 0.23.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef5bbe8385736e498dbb0033361f764ab43a435192513861447b9f7714b3fec" +"checksum uom 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3198c29f199fa8a23d732f4aa21ddc4f4d0a257cb0c2a44afea30145ce2575c1" "checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" "checksum utf8parse 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d" @@ -3379,7 +3440,7 @@ dependencies = [ "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum widestring 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" diff --git a/Cargo.toml b/Cargo.toml index 6ac4ac1f31..4fe370a622 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,7 +70,7 @@ semver = "0.9.0" uuid = {version = "0.7.4", features = [ "v4", "serde" ]} syntect = "3.2.0" onig_sys = "=69.1.0" -heim = "0.0.6" +heim = "0.0.7" which = "2.0.1" battery = "0.7.4" textwrap = {version = "0.11.0", features = ["term_size"]} diff --git a/src/object/dict.rs b/src/object/dict.rs index 86d6cf9ead..b090e4ef71 100644 --- a/src/object/dict.rs +++ b/src/object/dict.rs @@ -146,6 +146,13 @@ impl TaggedDictBuilder { dict: IndexMap::default(), } } + + pub fn with_capacity(tag: impl Into, n: usize) -> TaggedDictBuilder { + TaggedDictBuilder { + tag: tag.into(), + dict: IndexMap::with_capacity(n), + } + } pub fn insert(&mut self, key: impl Into, value: impl Into) { self.dict.insert(key.into(), value.into().tagged(self.tag)); diff --git a/src/plugins/sys.rs b/src/plugins/sys.rs index f22ed2a912..d92f0b377e 100644 --- a/src/plugins/sys.rs +++ b/src/plugins/sys.rs @@ -1,11 +1,13 @@ +use std::ffi::OsStr; + use futures::executor::block_on; use futures::stream::StreamExt; -use heim::{disk, memory, net}; use nu::{ serve_plugin, CallInfo, Plugin, Primitive, ReturnSuccess, ReturnValue, ShellError, Signature, Tag, Tagged, TaggedDictBuilder, Value, }; -use std::ffi::OsStr; +use heim::{disk, memory, net, sensors, host}; +use heim::units::{frequency, information, time, thermodynamic_temperature}; struct Sys; impl Sys { @@ -15,52 +17,65 @@ impl Sys { } async fn cpu(tag: Tag) -> Option> { - if let (Ok(num_cpu), Ok(cpu_speed)) = ( - heim::cpu::logical_count().await, - heim::cpu::frequency().await, - ) { - let mut cpu_idx = TaggedDictBuilder::new(tag); - cpu_idx.insert("cores", Primitive::Int(num_cpu as i64)); + match futures::future::try_join( + heim::cpu::logical_count(), + heim::cpu::frequency(), + ).await { + Ok((num_cpu, cpu_speed)) => { + let mut cpu_idx = TaggedDictBuilder::with_capacity(tag, 4); + cpu_idx.insert("cores", Primitive::Int(num_cpu as i64)); - let current_speed = - (cpu_speed.current().get() as f64 / 1000000000.0 * 100.0).round() / 100.0; - cpu_idx.insert("current ghz", Primitive::Float(current_speed.into())); + let current_speed = + (cpu_speed.current().get::() as f64 / 1_000_000_000.0 * 100.0).round() / 100.0; + cpu_idx.insert("current ghz", Primitive::Float(current_speed.into())); - if let Some(min_speed) = cpu_speed.min() { - let min_speed = (min_speed.get() as f64 / 1000000000.0 * 100.0).round() / 100.0; - cpu_idx.insert("min ghz", Primitive::Float(min_speed.into())); - } + if let Some(min_speed) = cpu_speed.min() { + let min_speed = (min_speed.get::() as f64 / 1_000_000_000.0 * 100.0).round() / 100.0; + cpu_idx.insert("min ghz", Primitive::Float(min_speed.into())); + } - if let Some(max_speed) = cpu_speed.max() { - let max_speed = (max_speed.get() as f64 / 1000000000.0 * 100.0).round() / 100.0; - cpu_idx.insert("max ghz", Primitive::Float(max_speed.into())); - } - Some(cpu_idx.into_tagged_value()) - } else { - None + if let Some(max_speed) = cpu_speed.max() { + let max_speed = (max_speed.get::() as f64 / 1_000_000_000.0 * 100.0).round() / 100.0; + cpu_idx.insert("max ghz", Primitive::Float(max_speed.into())); + } + + Some(cpu_idx.into_tagged_value()) + }, + Err(_) => None, } } async fn mem(tag: Tag) -> Tagged { - let mut dict = TaggedDictBuilder::new(tag); + let mut dict = TaggedDictBuilder::with_capacity(tag, 4); - if let Ok(memory) = memory::memory().await { - dict.insert("total", Value::bytes(memory.total().get())); - dict.insert("free", Value::bytes(memory.free().get())); + let (memory_result, swap_result) = futures::future::join( + memory::memory(), + memory::swap() + ).await; + + if let Ok(memory) = memory_result { + dict.insert("total", Value::bytes(memory.total().get::())); + dict.insert("free", Value::bytes(memory.free().get::())); } - if let Ok(swap) = memory::swap().await { - dict.insert("swap total", Value::bytes(swap.total().get())); - dict.insert("swap free", Value::bytes(swap.free().get())); + + if let Ok(swap) = swap_result { + dict.insert("swap total", Value::bytes(swap.total().get::())); + dict.insert("swap free", Value::bytes(swap.free().get::())); } dict.into_tagged_value() } async fn host(tag: Tag) -> Tagged { - let mut dict = TaggedDictBuilder::new(tag); + let mut dict = TaggedDictBuilder::with_capacity(tag, 6); + + let (platform_result, uptime_result) = futures::future::join( + host::platform(), + host::uptime(), + ).await; // OS - if let Ok(platform) = heim::host::platform().await { + if let Ok(platform) = platform_result { dict.insert("name", Value::string(platform.system())); dict.insert("release", Value::string(platform.release())); dict.insert("hostname", Value::string(platform.hostname())); @@ -68,10 +83,10 @@ async fn host(tag: Tag) -> Tagged { } // Uptime - if let Ok(uptime) = heim::host::uptime().await { - let mut uptime_dict = TaggedDictBuilder::new(tag); + if let Ok(uptime) = uptime_result { + let mut uptime_dict = TaggedDictBuilder::with_capacity(tag, 4); - let uptime = uptime.get().round() as i64; + let uptime = uptime.get::().round() as i64; let days = uptime / (60 * 60 * 24); let hours = (uptime - days * 60 * 60 * 24) / (60 * 60); let minutes = (uptime - days * 60 * 60 * 24 - hours * 60 * 60) / 60; @@ -82,11 +97,11 @@ async fn host(tag: Tag) -> Tagged { uptime_dict.insert("mins", Value::int(minutes)); uptime_dict.insert("secs", Value::int(seconds)); - dict.insert_tagged("uptime", uptime_dict.into_tagged_value()); + dict.insert_tagged("uptime", uptime_dict); } // Users - let mut users = heim::host::users(); + let mut users = host::users(); let mut user_vec = vec![]; while let Some(user) = users.next().await { if let Ok(user) = user { @@ -104,7 +119,7 @@ async fn disks(tag: Tag) -> Option { let mut partitions = disk::partitions_physical(); while let Some(part) = partitions.next().await { if let Ok(part) = part { - let mut dict = TaggedDictBuilder::new(tag); + let mut dict = TaggedDictBuilder::with_capacity(tag, 6); dict.insert( "device", Value::string( @@ -116,16 +131,18 @@ async fn disks(tag: Tag) -> Option { dict.insert("type", Value::string(part.file_system().as_str())); dict.insert("mount", Value::string(part.mount_point().to_string_lossy())); + if let Ok(usage) = disk::usage(part.mount_point().to_path_buf()).await { - dict.insert("total", Value::bytes(usage.total().get())); - dict.insert("used", Value::bytes(usage.used().get())); - dict.insert("free", Value::bytes(usage.free().get())); + dict.insert("total", Value::bytes(usage.total().get::())); + dict.insert("used", Value::bytes(usage.used().get::())); + dict.insert("free", Value::bytes(usage.free().get::())); } + output.push(dict.into_tagged_value()); } } - if output.len() > 0 { + if !output.is_empty() { Some(Value::List(output)) } else { None @@ -167,57 +184,56 @@ async fn battery(tag: Tag) -> Option { } } - if output.len() > 0 { + if !output.is_empty() { Some(Value::List(output)) } else { None } } -// FIXME: add back when heim releases new version -// async fn temp(tag: Tag) -> Option { -// let mut output = vec![]; +async fn temp(tag: Tag) -> Option { + let mut output = vec![]; -// let mut sensors = sensors::temperatures(); -// while let Some(sensor) = sensors.next().await { -// if let Ok(sensor) = sensor { -// let mut dict = TaggedDictBuilder::new(tag); -// dict.insert("unit", Value::string(sensor.unit())); -// if let Some(label) = sensor.label() { -// dict.insert("label", Value::string(label)); -// } -// dict.insert("temp", Value::float(sensor.current().get())); -// if let Some(high) = sensor.high() { -// dict.insert("high", Value::float(high.get())); -// } -// if let Some(critical) = sensor.critical() { -// dict.insert("critical", Value::float(critical.get())); -// } + let mut sensors = sensors::temperatures(); + while let Some(sensor) = sensors.next().await { + if let Ok(sensor) = sensor { + let mut dict = TaggedDictBuilder::new(tag); + dict.insert("unit", Value::string(sensor.unit())); + if let Some(label) = sensor.label() { + dict.insert("label", Value::string(label)); + } + dict.insert("temp", Value::float(sensor.current().get::() as f64)); + if let Some(high) = sensor.high() { + dict.insert("high", Value::float(high.get::() as f64)); + } + if let Some(critical) = sensor.critical() { + dict.insert("critical", Value::float(critical.get::() as f64)); + } -// output.push(dict.into_tagged_value()); -// } -// } + output.push(dict.into_tagged_value()); + } + } -// if output.len() > 0 { -// Some(Value::List(output)) -// } else { -// None -// } -// } + if !output.is_empty() { + Some(Value::List(output)) + } else { + None + } +} async fn net(tag: Tag) -> Option { let mut output = vec![]; let mut io_counters = net::io_counters(); while let Some(nic) = io_counters.next().await { if let Ok(nic) = nic { - let mut network_idx = TaggedDictBuilder::new(tag); + let mut network_idx = TaggedDictBuilder::with_capacity(tag, 3); network_idx.insert("name", Value::string(nic.interface())); - network_idx.insert("sent", Value::bytes(nic.bytes_sent().get())); - network_idx.insert("recv", Value::bytes(nic.bytes_recv().get())); + network_idx.insert("sent", Value::bytes(nic.bytes_sent().get::())); + network_idx.insert("recv", Value::bytes(nic.bytes_recv().get::())); output.push(network_idx.into_tagged_value()); } } - if output.len() > 0 { + if !output.is_empty() { Some(Value::List(output)) } else { None @@ -225,23 +241,35 @@ async fn net(tag: Tag) -> Option { } async fn sysinfo(tag: Tag) -> Vec> { - let mut sysinfo = TaggedDictBuilder::new(tag); + let mut sysinfo = TaggedDictBuilder::with_capacity(tag, 7); + + let (host, cpu, disks, memory, temp) = futures::future::join5( + host(tag), + cpu(tag), + disks(tag), + mem(tag), + temp(tag), + ).await; + let (net, battery) = futures::future::join( + net(tag), + battery(tag), + ).await; - sysinfo.insert_tagged("host", host(tag).await); - if let Some(cpu) = cpu(tag).await { + sysinfo.insert_tagged("host", host); + if let Some(cpu) = cpu { sysinfo.insert_tagged("cpu", cpu); } - if let Some(disks) = disks(tag).await { + if let Some(disks) = disks { sysinfo.insert("disks", disks); } - sysinfo.insert_tagged("mem", mem(tag).await); - // if let Some(temp) = temp(tag).await { - // sysinfo.insert("temp", temp); - // } - if let Some(net) = net(tag).await { + sysinfo.insert_tagged("mem", memory); + if let Some(temp) = temp { + sysinfo.insert("temp", temp); + } + if let Some(net) = net { sysinfo.insert("net", net); } - if let Some(battery) = battery(tag).await { + if let Some(battery) = battery { sysinfo.insert("battery", battery); } @@ -256,7 +284,7 @@ impl Plugin for Sys { fn begin_filter(&mut self, callinfo: CallInfo) -> Result, ShellError> { Ok(block_on(sysinfo(Tag::unknown_origin(callinfo.name_span))) .into_iter() - .map(|x| ReturnSuccess::value(x)) + .map(ReturnSuccess::value) .collect()) }