Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
spatial_matcap.rs

1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4/// One of the baked matcaps in the volumesight atlas.
5#[derive(
6    Debug,
7    Clone,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash,
13    conjure_object::serde::Deserialize,
14    conjure_object::serde::Serialize,
15)]
16#[serde(crate = "conjure_object::serde")]
17pub enum SpatialMatcap {
18    #[serde(rename = "SOAP")]
19    Soap,
20    #[serde(rename = "SILVER")]
21    Silver,
22    #[serde(rename = "GOLD")]
23    Gold,
24    #[serde(rename = "PLASTIC")]
25    Plastic,
26    #[serde(rename = "TILE")]
27    Tile,
28    #[serde(rename = "VIOLET_CHROME")]
29    VioletChrome,
30    #[serde(rename = "TRAFFIC_CONE")]
31    TrafficCone,
32    #[serde(rename = "EMERALD")]
33    Emerald,
34    #[serde(rename = "AMETHYST")]
35    Amethyst,
36    #[serde(rename = "BLUE_PAINT")]
37    BluePaint,
38    #[serde(rename = "RED_CAR")]
39    RedCar,
40    #[serde(rename = "BEETLE")]
41    Beetle,
42    #[serde(rename = "BUBBLE")]
43    Bubble,
44    #[serde(rename = "PEARL")]
45    Pearl,
46    #[serde(rename = "WAX")]
47    Wax,
48    #[serde(rename = "MARBLE")]
49    Marble,
50    /// An unknown variant.
51    #[serde(untagged)]
52    Unknown(Unknown),
53}
54impl SpatialMatcap {
55    /// Returns the string representation of the enum.
56    #[inline]
57    pub fn as_str(&self) -> &str {
58        match self {
59            SpatialMatcap::Soap => "SOAP",
60            SpatialMatcap::Silver => "SILVER",
61            SpatialMatcap::Gold => "GOLD",
62            SpatialMatcap::Plastic => "PLASTIC",
63            SpatialMatcap::Tile => "TILE",
64            SpatialMatcap::VioletChrome => "VIOLET_CHROME",
65            SpatialMatcap::TrafficCone => "TRAFFIC_CONE",
66            SpatialMatcap::Emerald => "EMERALD",
67            SpatialMatcap::Amethyst => "AMETHYST",
68            SpatialMatcap::BluePaint => "BLUE_PAINT",
69            SpatialMatcap::RedCar => "RED_CAR",
70            SpatialMatcap::Beetle => "BEETLE",
71            SpatialMatcap::Bubble => "BUBBLE",
72            SpatialMatcap::Pearl => "PEARL",
73            SpatialMatcap::Wax => "WAX",
74            SpatialMatcap::Marble => "MARBLE",
75            SpatialMatcap::Unknown(v) => &*v,
76        }
77    }
78}
79impl fmt::Display for SpatialMatcap {
80    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
81        fmt::Display::fmt(self.as_str(), fmt)
82    }
83}
84impl conjure_object::Plain for SpatialMatcap {
85    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
86        conjure_object::Plain::fmt(self.as_str(), fmt)
87    }
88}
89impl str::FromStr for SpatialMatcap {
90    type Err = conjure_object::plain::ParseEnumError;
91    #[inline]
92    fn from_str(
93        v: &str,
94    ) -> Result<SpatialMatcap, conjure_object::plain::ParseEnumError> {
95        match v {
96            "SOAP" => Ok(SpatialMatcap::Soap),
97            "SILVER" => Ok(SpatialMatcap::Silver),
98            "GOLD" => Ok(SpatialMatcap::Gold),
99            "PLASTIC" => Ok(SpatialMatcap::Plastic),
100            "TILE" => Ok(SpatialMatcap::Tile),
101            "VIOLET_CHROME" => Ok(SpatialMatcap::VioletChrome),
102            "TRAFFIC_CONE" => Ok(SpatialMatcap::TrafficCone),
103            "EMERALD" => Ok(SpatialMatcap::Emerald),
104            "AMETHYST" => Ok(SpatialMatcap::Amethyst),
105            "BLUE_PAINT" => Ok(SpatialMatcap::BluePaint),
106            "RED_CAR" => Ok(SpatialMatcap::RedCar),
107            "BEETLE" => Ok(SpatialMatcap::Beetle),
108            "BUBBLE" => Ok(SpatialMatcap::Bubble),
109            "PEARL" => Ok(SpatialMatcap::Pearl),
110            "WAX" => Ok(SpatialMatcap::Wax),
111            "MARBLE" => Ok(SpatialMatcap::Marble),
112            v => v.parse().map(|v| SpatialMatcap::Unknown(Unknown(v))),
113        }
114    }
115}
116impl conjure_object::FromPlain for SpatialMatcap {
117    type Err = conjure_object::plain::ParseEnumError;
118    #[inline]
119    fn from_plain(
120        v: &str,
121    ) -> Result<SpatialMatcap, conjure_object::plain::ParseEnumError> {
122        v.parse()
123    }
124}
125///An unknown variant of the SpatialMatcap enum.
126#[derive(
127    Debug,
128    Clone,
129    PartialEq,
130    Eq,
131    PartialOrd,
132    Ord,
133    Hash,
134    conjure_object::serde::Deserialize,
135    conjure_object::serde::Serialize,
136)]
137#[serde(crate = "conjure_object::serde", transparent)]
138pub struct Unknown(conjure_object::private::Variant);
139impl std::ops::Deref for Unknown {
140    type Target = str;
141    #[inline]
142    fn deref(&self) -> &str {
143        &self.0
144    }
145}
146impl fmt::Display for Unknown {
147    #[inline]
148    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
149        fmt::Display::fmt(&self.0, fmt)
150    }
151}