#platform #info #system

platform-info

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

8 releases (5 stable)

2.0.1 May 27, 2023
2.0.0 May 22, 2023
1.0.2 Jan 9, 2023
1.0.1 Nov 8, 2022
0.0.1 Jul 27, 2018

#31 in Operating systems

Download history 8506/week @ 2023-02-16 7479/week @ 2023-02-23 6088/week @ 2023-03-02 9104/week @ 2023-03-09 9676/week @ 2023-03-16 17192/week @ 2023-03-23 7737/week @ 2023-03-30 5331/week @ 2023-04-06 5837/week @ 2023-04-13 6511/week @ 2023-04-20 5940/week @ 2023-04-27 7226/week @ 2023-05-04 5610/week @ 2023-05-11 5272/week @ 2023-05-18 5959/week @ 2023-05-25 5653/week @ 2023-06-01

23,394 downloads per month
Used in 9 crates (7 directly)

MIT license

73KB
1K SLoC

platform-info

Crates.io License CodeCov

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

Example

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().unwrap();
    // 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.

License

platform-info is licensed under the MIT License.

Dependencies

~36KB