You've already forked platform-info
mirror of
https://github.com/uutils/platform-info.git
synced 2026-06-10 15:48:45 -07:00
19 lines
670 B
Rust
19 lines
670 B
Rust
// 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); // note: info *may* contain extra platform-specific fields
|
|
|
|
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());
|
|
}
|