#system #fetch #cli

libmacchina

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

86 releases (22 stable)

new 3.2.2 Oct 21, 2021
2.1.8 Oct 6, 2021
1.0.4 Sep 14, 2021
0.9.0 Aug 21, 2021
0.1.3 Mar 22, 2021

#47 in Operating systems

Download history 67/week @ 2021-07-01 198/week @ 2021-07-08 121/week @ 2021-07-15 67/week @ 2021-07-22 156/week @ 2021-07-29 359/week @ 2021-08-05 728/week @ 2021-08-12 369/week @ 2021-08-19 156/week @ 2021-08-26 374/week @ 2021-09-02 253/week @ 2021-09-09 727/week @ 2021-09-16 181/week @ 2021-09-23 455/week @ 2021-09-30 249/week @ 2021-10-07 711/week @ 2021-10-14

1,670 downloads per month
Used in macchina

MIT license

155KB
3.5K SLoC

libmacchina

A library providing access to all sorts of system information.

Linux • macOS • Windows • NetBSD • FreeBSD • Android • OpenWrt

version docs

Usage

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

libmacchina = "3"

Examples

// Let's import two of the several available 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 _;

    let general_readout = GeneralReadout::new();

    // There are many more metrics we can query
    // i.e. username, distribution, terminal, shell, etc.
    let cpu_cores = general_readout.cpu_cores().unwrap(); // 8 [logical cores]
    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.5–3MB
~72K SLoC