Skip to main content

os_identifier/
lib.rs

1// todo:
2// add more examples with arbitrary strings
3// showing what we know about the OS not only the string.
4// Update introducing sentence to match README.md
5
6
7//! # OS Identifier
8//!
9//! OS Identifier resolves product / release names of operating systems used by
10//! endoflife.date into canonical names.
11//!
12//! ```
13//! use os_identifier::OS;
14//!
15//! fn main() {
16//!     let os = OS::parse("11-24h2-w").unwrap();
17//!
18//!     assert_eq!(os.vendor(), String::from("Microsoft"));
19//!     assert_eq!(os.product(), String::from("Windows 11"));
20//!
21//!     assert!(os.to_string().contains(&String::from("Microsoft Windows 11 Pro 24H2")));
22//! }
23//! ```
24//!
25//! If you already know it is a Windows, you can use this as well.
26//!
27//! ```
28//! use os_identifier::Windows;
29//!
30//! fn main() {
31//!     let os_strings = Windows::parse("11-24h2-w").unwrap();
32//!
33//!     assert!(os_strings.to_string().contains(&String::from("Microsoft Windows 11 Pro 24H2")));
34//! }
35//! ```
36mod model;
37pub use model::OS;
38pub use model::Windows;
39
40mod parser;
41
42mod util;