Skip to content

A cross-platform way to get information about your machine

License

Notifications You must be signed in to change notification settings

uutils/platform-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

841bdd9 · Jul 12, 2023
Mar 11, 2018
Jun 14, 2023
May 29, 2023
May 28, 2023
Jul 11, 2023
Jun 13, 2023
May 29, 2023
Jan 4, 2023
Mar 6, 2018
May 29, 2023
Jul 11, 2023
Feb 14, 2023
May 28, 2023
Mar 24, 2023

Repository files navigation

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.