mirror of
https://github.com/uutils/platform-info.git
synced 2026-06-10 15:48:45 -07:00
docs ~ add arch example
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// examples/arch.rs
|
||||
// * use `cargo run --example arch` to execute this example
|
||||
|
||||
// spell-checker:ignore (API) nodename osname sysname
|
||||
|
||||
use platform_info::*;
|
||||
|
||||
fn main() {
|
||||
let info = PlatformInfo::new().unwrap();
|
||||
println!(
|
||||
"{}",
|
||||
match info.machine().to_os_string().into_string() {
|
||||
Ok(s) => s,
|
||||
Err(os_s) => {
|
||||
let s = os_s.to_string_lossy();
|
||||
eprintln!("machine = [{}]'{:?}' => '{}'", os_s.len(), os_s, s);
|
||||
String::from(s)
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user