unity_types/
platform.rs

1use std::fmt;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
5#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
6pub enum UnityReleaseDownloadArchitecture {
7    X86_64,
8    Arm64
9}
10
11impl Default for UnityReleaseDownloadArchitecture {
12    fn default() -> Self {
13        if cfg!(target_arch = "x86_64") {
14            Self::X86_64
15        } else if cfg!(target_arch = "aarch64") {
16            Self::Arm64
17        } else {
18            panic!("Not supported on current architecture")
19        }
20    }
21}
22
23#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
24#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
25pub enum UnityReleaseDownloadPlatform {
26    MacOs,
27    Linux,
28    Windows
29}
30
31impl Default for UnityReleaseDownloadPlatform {
32    fn default() -> Self {
33        if cfg!(target_os = "linux") {
34            Self::Linux
35        } else if cfg!(target_os = "windows") {
36            Self::Windows
37        } else if cfg!(target_os = "macos") {
38            Self::MacOs
39        } else {
40            panic!("Not supported on current OS")
41        }
42    }
43}
44
45#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
46#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
47pub enum UnityReleaseStream {
48    Lts,
49    Beta,
50    Alpha,
51    Tech,
52}
53
54impl Default for UnityReleaseStream {
55    fn default() -> Self {
56        Self::Lts
57    }
58}
59
60#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy, Deserialize, Serialize)]
61#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
62pub enum UnityReleaseCategory {
63    Documentation,
64    Platform,
65    LanguagePack,
66    DevTool,
67    Plugin,
68    Component,
69}
70
71impl fmt::Display for UnityReleaseCategory {
72    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
73        use UnityReleaseCategory::*;
74        let s = match self {
75            DevTool => "Dev tools",
76            Plugin => "Plugins",
77            Documentation => "Documentation",
78            Component => "Components",
79            Platform => "Platform",
80            LanguagePack => "Language packs (Preview)",
81        };
82        write!(f, "{}", s)
83    }
84}
85
86#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy, Deserialize, Serialize)]
87#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
88pub enum UnityReleaseSkuFamily {
89    Classic,
90    Dots
91}