Debian Codegraph @

README.md

raw symbols SCIP
1 # platform-info
2
3 <!-- spell-checker:ignore (API) nodename osname sysname (rust) println -->
4
5 [![Crates.io](https://img.shields.io/crates/v/platform-info.svg)](https://crates.io/crates/platform-info)
6 [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7 [![CodeCov](https://codecov.io/gh/uutils/platform-info/branch/main/graph/badge.svg)](https://codecov.io/gh/uutils/platform-info/tree/main)
8
9 A simple cross-platform way to get information about the currently running system.
10
11 ## Examples
12
13 This simple example:
14
15 ```rust
16 // examples/ex.rs
17 // * use `cargo run --example ex` to execute this example
18
19 // spell-checker:ignore (API) nodename osname sysname
20
21 use platform_info::*;
22
23 fn main() {
24 let info = PlatformInfo::new().expect("Unable to determine platform info");
25 // println!("info={:#?}", info);
26
27 println!("{}", info.sysname().to_string_lossy());
28 println!("{}", info.nodename().to_string_lossy());
29 println!("{}", info.release().to_string_lossy());
30 println!("{}", info.version().to_string_lossy());
31 println!("{}", info.machine().to_string_lossy());
32 println!("{}", info.osname().to_string_lossy());
33 }
34 ```
35
36 should display something like:
37
38 ```text
39 Linux
40 hostname
41 5.10.0-8-amd64
42 #1 SMP Debian 5.10.46-4 (2021-08-03)
43 x86_64
44 GNU/Linux
45 ```
46
47 > Using `cargo run --example ex` will build and execute this [example code](examples/ex.rs).
48
49 Other examples can be found in the [examples](examples) directory.
50
51 ## License
52
53 `platform-info` is licensed under the [MIT License](LICENSE).