1use alloc::string::String;
2use core::fmt::{self, Display, Formatter};
3
4#[allow(missing_docs)]
6#[derive(Debug, PartialEq, Eq, Clone)]
7#[non_exhaustive]
8pub enum Platform {
9 Unknown(String),
10 Linux,
11 Bsd,
12 Windows,
13 Mac,
14 Illumos,
15 Ios,
16 Android,
17 Nintendo3ds,
18 PlayStation,
19 Fuchsia,
20 Redox,
21 Hurd,
22}
23
24impl Display for Platform {
25 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
26 if let Self::Unknown(_) = self {
27 f.write_str("Unknown: ")?;
28 }
29
30 f.write_str(match self {
31 Self::Unknown(a) => a,
32 Self::Linux => "Linux",
33 Self::Bsd => "BSD",
34 Self::Windows => "Windows",
35 Self::Mac => "macOS",
36 Self::Illumos => "illumos",
37 Self::Ios => "iOS",
38 Self::Android => "Android",
39 Self::Nintendo3ds => "Nintendo 3DS",
40 Self::PlayStation => "PlayStation",
41 Self::Fuchsia => "Fuchsia",
42 Self::Redox => "Redox",
43 Self::Hurd => "GNU Hurd",
44 })
45 }
46}