#system-info #system #info #platform #system-api

platform-info

A simple cross-platform interface to get info about a system

10 releases (stable)

2.0.3 Apr 11, 2024
2.0.2 Jul 12, 2023
2.0.1 May 27, 2023
1.0.2 Jan 9, 2023
0.0.1 Jul 27, 2018

#27 in Operating systems

Download history 8582/week @ 2024-01-03 11181/week @ 2024-01-10 11704/week @ 2024-01-17 11603/week @ 2024-01-24 13369/week @ 2024-01-31 11551/week @ 2024-02-07 10782/week @ 2024-02-14 18344/week @ 2024-02-21 22442/week @ 2024-02-28 26532/week @ 2024-03-06 20662/week @ 2024-03-13 19324/week @ 2024-03-20 18948/week @ 2024-03-27 17468/week @ 2024-04-03 20317/week @ 2024-04-10 15426/week @ 2024-04-17

74,397 downloads per month
Used in 23 crates (11 directly)

MIT license

79KB
1K SLoC

platform-info

Crates.io License CodeCov

A simple cross-platform way to get information about the currently running system.

Examples

This simple example:

// examples/ex.rs
// * use `cargo run --example ex` to execute this example

// spell-checker:ignore (API) nodename osname sysname

use platform_info::*;

fn main() {
    let info = PlatformInfo::new().expect("Unable to determine platform info");
    // println!("info={:#?}", info);

    println!("{}", info.sysname().to_string_lossy());
    println!("{}", info.nodename().to_string_lossy());
    println!("{}", info.release().to_string_lossy());
    println!("{}", info.version().to_string_lossy());
    println!("{}", info.machine().to_string_lossy());
    println!("{}", info.osname().to_string_lossy());
}

should display something like:

Linux
hostname
5.10.0-8-amd64
#1 SMP Debian 5.10.46-4 (2021-08-03)
x86_64
GNU/Linux

Using cargo run --example ex will build and execute this example code.

Other examples can be found in the examples directory.

License

platform-info is licensed under the MIT License.

Dependencies

~215KB