1use std::fmt;
2use std::fmt::Display;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, Hash, Ord, PartialOrd, PartialEq, Eq, Serialize, Deserialize)]
6#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
7#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
8pub enum UnityReleaseDownloadArchitecture {
9 X86_64,
10 Arm64
11}
12
13impl Default for UnityReleaseDownloadArchitecture {
14 fn default() -> Self {
15 if cfg!(target_os = "linux") {
17 Self::X86_64
18 } else if cfg!(target_arch = "x86_64") {
19 Self::X86_64
20 } else if cfg!(target_arch = "aarch64") {
21 Self::Arm64
22 } else {
23 panic!("Not supported on current architecture")
24 }
25 }
26}
27
28impl Display for UnityReleaseDownloadArchitecture {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 use UnityReleaseDownloadArchitecture::*;
31 let s = match self {
32 X86_64 => "x86_64",
33 Arm64 => "arm64",
34 };
35 write!(f, "{}", s)
36 }
37}
38
39#[derive(Debug, Clone, Copy, Hash, Ord, PartialOrd, PartialEq, Eq, Serialize, Deserialize)]
40#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
41#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
42pub enum UnityReleaseDownloadPlatform {
43 MacOs,
44 Linux,
45 Windows
46}
47
48impl Default for UnityReleaseDownloadPlatform {
49 fn default() -> Self {
50 if cfg!(target_os = "linux") {
51 Self::Linux
52 } else if cfg!(target_os = "windows") {
53 Self::Windows
54 } else if cfg!(target_os = "macos") {
55 Self::MacOs
56 } else {
57 panic!("Not supported on current OS")
58 }
59 }
60}
61
62impl Display for UnityReleaseDownloadPlatform {
63 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
64 use UnityReleaseDownloadPlatform::*;
65 let s = match self {
66 MacOs => "macOS",
67 Linux => "Linux",
68 Windows => "Windows",
69 };
70 write!(f, "{}", s)
71 }
72}
73
74#[derive(Debug, Clone, Copy, Hash, Ord, PartialOrd, PartialEq, Eq, Serialize, Deserialize)]
75#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
76#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
77pub enum UnityReleaseStream {
78 Lts,
79 Beta,
80 Alpha,
81 Tech,
82 Supported,
83}
84
85impl Default for UnityReleaseStream {
86 fn default() -> Self {
87 Self::Lts
88 }
89}
90
91impl Display for UnityReleaseStream {
92 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
93 use UnityReleaseStream::*;
94 let s = match self {
95 Lts => "LTS",
96 Beta => "Beta",
97 Alpha => "Alpha",
98 Tech => "Tech Preview",
99 Supported => "Supported",
100 };
101 write!(f, "{}", s)
102 }
103}
104
105#[derive(Debug, Clone, Copy, Hash, Ord, PartialOrd, PartialEq, Eq, Serialize, Deserialize)]
106#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
107#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
108pub enum UnityReleaseEntitlement {
109 Xlts,
110 U7Alpha,
111}
112
113impl Display for UnityReleaseEntitlement {
114 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
115 use UnityReleaseEntitlement::*;
116 let s = match self {
117 Xlts => "XLTS",
118 U7Alpha => "U7 Alpha",
119 };
120 write!(f, "{}", s)
121 }
122}
123
124#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy, Deserialize, Serialize)]
125#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
126#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
127pub enum UnityReleaseCategory {
128 Documentation,
129 Platform,
130 LanguagePack,
131 DevTool,
132 Plugin,
133 Component,
134}
135
136impl fmt::Display for UnityReleaseCategory {
137 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
138 use UnityReleaseCategory::*;
139 let s = match self {
140 DevTool => "Dev tools",
141 Plugin => "Plugins",
142 Documentation => "Documentation",
143 Component => "Components",
144 Platform => "Platform",
145 LanguagePack => "Language packs (Preview)",
146 };
147 write!(f, "{}", s)
148 }
149}
150
151#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy, Deserialize, Serialize)]
152#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
153pub enum UnityReleaseSkuFamily {
154 Classic,
155 Dots
156}