Crates.io | platform-info |
lib.rs | platform-info |
version | 2.0.4 |
source | src |
created_at | 2018-07-27 22:39:34.779503 |
updated_at | 2024-09-28 20:44:56.984749 |
description | A simple cross-platform interface to get info about a system |
homepage | https://github.com/uutils/platform-info |
repository | https://github.com/uutils/platform-info |
max_upload_size | |
id | 76275 |
size | 104,197 |
A simple cross-platform way to get information about the currently running system.
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.
platform-info
is licensed under the MIT License.