12 releases (stable)

2.0.5 Dec 22, 2024
2.0.4 Sep 28, 2024
2.0.3 Apr 11, 2024
2.0.2 Jul 12, 2023
0.0.1 Jul 27, 2018

#100 in Command-line interface

Download history 60411/week @ 2025-10-09 66201/week @ 2025-10-16 66308/week @ 2025-10-23 51316/week @ 2025-10-30 63188/week @ 2025-11-06 58361/week @ 2025-11-13 65866/week @ 2025-11-20 78000/week @ 2025-11-27 90483/week @ 2025-12-04 80133/week @ 2025-12-11 98923/week @ 2025-12-18 137385/week @ 2025-12-25 134256/week @ 2026-01-01 128392/week @ 2026-01-08 140852/week @ 2026-01-15 124119/week @ 2026-01-22

547,022 downloads per month
Used in 31 crates (15 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