summaryrefslogtreecommitdiffstats
path: root/vendor/os_info/examples
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:35 +0000
commit7e5d7eea9c580ef4b41a765bde624af431942b96 (patch)
tree2c0d9ca12878fc4525650aa4e54d77a81a07cc09 /vendor/os_info/examples
parentAdding debian version 1.70.0+dfsg1-9. (diff)
downloadrustc-7e5d7eea9c580ef4b41a765bde624af431942b96.tar.xz
rustc-7e5d7eea9c580ef4b41a765bde624af431942b96.zip
Merging upstream version 1.70.0+dfsg2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/os_info/examples')
-rw-r--r--vendor/os_info/examples/print_version.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/os_info/examples/print_version.rs b/vendor/os_info/examples/print_version.rs
new file mode 100644
index 000000000..0047fbcc2
--- /dev/null
+++ b/vendor/os_info/examples/print_version.rs
@@ -0,0 +1,13 @@
+fn main() {
+ let info = os_info::get();
+
+ // Print full information:
+ println!("OS information: {}", info);
+
+ // Print information separately:
+ println!("Type: {}", info.os_type());
+ println!("Version: {}", info.version());
+ println!("Edition: {:?}", info.edition());
+ println!("Codename: {:?}", info.codename());
+ println!("Bitness: {}", info.bitness());
+}