#system #fetch #cli

libmacchina

A library that can fetch all sorts of system information, super-duper fast!

43 releases (4 breaking)

0.5.8 Jul 10, 2021
0.5.7 Jul 10, 2021
0.5.3 Jun 25, 2021
0.4.10 Jun 8, 2021
0.1.3 Mar 22, 2021

#4 in #fetch

Download history 312/week @ 2021-04-12 456/week @ 2021-04-19 232/week @ 2021-04-26 342/week @ 2021-05-03 168/week @ 2021-05-10 610/week @ 2021-05-17 102/week @ 2021-05-24 348/week @ 2021-05-31 436/week @ 2021-06-07 107/week @ 2021-06-14 272/week @ 2021-06-21 139/week @ 2021-06-28 182/week @ 2021-07-05 84/week @ 2021-07-12 112/week @ 2021-07-19 115/week @ 2021-07-26

1,222 downloads per month
Used in macchina

MIT license

135KB
3K SLoC

libmacchina

A library that can fetch all sorts of system information, super-duper fast!

Linux • macOS • Windows • NetBSD • Android • OpenWrt

version docs

Usage

Add the following to your project's Cargo.toml file:

libmacchina = "0.5.0"

Examples

// Let's import two of the several types.
use libmacchina::{GeneralReadout, MemoryReadout};

fn main() {
    // Let's import the GeneralReadout trait so we
    // can fetch some general information about the host.
    use libmacchina::traits::GeneralReadout as _;
    
    // There are too many  functions within GeneralReadout to list, but you get the gist ;)
    let general_readout = GeneralReadout::new();
    let cpu_cores = general_readout.cpu_cores().unwrap();          // 8
    let cpu = general_readout.cpu_model_name().unwrap();          // Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
    let uptime = general_readout.uptime().unwrap();                // 1500 [in seconds]

    // Now we'll import the MemoryReadout trait to get an
    // idea of what the host's memory usage looks like.
    use libmacchina::traits::MemoryReadout as _;

    let memory_readout = MemoryReadout::new();          
    let total_mem = memory_readout.total();       // 20242204 [in kB]
    let used_mem = memory_readout.used();         // 3894880 [in kB]
}

Dependencies

~0–2.4MB
~25K SLoC