2023-02-12 10:39:01 -06:00
|
|
|
// examples/ex.rs
|
|
|
|
|
// * use `cargo run --example ex` to execute this example
|
|
|
|
|
|
|
|
|
|
// spell-checker:ignore (API) nodename osname sysname
|
2023-01-08 13:10:39 -06:00
|
|
|
|
2024-04-09 23:14:36 +02:00
|
|
|
use platform_info::{PlatformInfo, PlatformInfoAPI, UNameAPI};
|
2023-01-08 13:10:39 -06:00
|
|
|
|
|
|
|
|
fn main() {
|
2023-05-26 10:40:10 -05:00
|
|
|
let info = PlatformInfo::new().expect("Unable to determine platform info");
|
|
|
|
|
// println!("info={:#?}", info); // note: info *may* contain extra platform-specific fields
|
2023-02-12 10:39:01 -06:00
|
|
|
|
2023-02-12 12:48:32 -06:00
|
|
|
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());
|
2025-11-27 20:41:41 +07:00
|
|
|
println!("{}", info.processor().to_string_lossy());
|
2023-02-12 12:48:32 -06:00
|
|
|
println!("{}", info.osname().to_string_lossy());
|
2023-01-08 13:10:39 -06:00
|
|
|
}
|