Skip to main content

nominal_api_conjure/conjure/objects/scout/chartdefinition/api/
geo3d_model_axis.rs

1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4#[derive(
5    Debug,
6    Clone,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash,
12    conjure_object::serde::Deserialize,
13    conjure_object::serde::Serialize,
14)]
15#[serde(crate = "conjure_object::serde")]
16pub enum Geo3dModelAxis {
17    #[serde(rename = "X")]
18    X,
19    #[serde(rename = "Y")]
20    Y,
21    #[serde(rename = "Z")]
22    Z,
23    #[serde(rename = "NEG_X")]
24    NegX,
25    #[serde(rename = "NEG_Y")]
26    NegY,
27    #[serde(rename = "NEG_Z")]
28    NegZ,
29    /// An unknown variant.
30    #[serde(untagged)]
31    Unknown(Unknown),
32}
33impl Geo3dModelAxis {
34    /// Returns the string representation of the enum.
35    #[inline]
36    pub fn as_str(&self) -> &str {
37        match self {
38            Geo3dModelAxis::X => "X",
39            Geo3dModelAxis::Y => "Y",
40            Geo3dModelAxis::Z => "Z",
41            Geo3dModelAxis::NegX => "NEG_X",
42            Geo3dModelAxis::NegY => "NEG_Y",
43            Geo3dModelAxis::NegZ => "NEG_Z",
44            Geo3dModelAxis::Unknown(v) => &*v,
45        }
46    }
47}
48impl fmt::Display for Geo3dModelAxis {
49    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
50        fmt::Display::fmt(self.as_str(), fmt)
51    }
52}
53impl conjure_object::Plain for Geo3dModelAxis {
54    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
55        conjure_object::Plain::fmt(self.as_str(), fmt)
56    }
57}
58impl str::FromStr for Geo3dModelAxis {
59    type Err = conjure_object::plain::ParseEnumError;
60    #[inline]
61    fn from_str(
62        v: &str,
63    ) -> Result<Geo3dModelAxis, conjure_object::plain::ParseEnumError> {
64        match v {
65            "X" => Ok(Geo3dModelAxis::X),
66            "Y" => Ok(Geo3dModelAxis::Y),
67            "Z" => Ok(Geo3dModelAxis::Z),
68            "NEG_X" => Ok(Geo3dModelAxis::NegX),
69            "NEG_Y" => Ok(Geo3dModelAxis::NegY),
70            "NEG_Z" => Ok(Geo3dModelAxis::NegZ),
71            v => v.parse().map(|v| Geo3dModelAxis::Unknown(Unknown(v))),
72        }
73    }
74}
75impl conjure_object::FromPlain for Geo3dModelAxis {
76    type Err = conjure_object::plain::ParseEnumError;
77    #[inline]
78    fn from_plain(
79        v: &str,
80    ) -> Result<Geo3dModelAxis, conjure_object::plain::ParseEnumError> {
81        v.parse()
82    }
83}
84///An unknown variant of the Geo3dModelAxis enum.
85#[derive(
86    Debug,
87    Clone,
88    PartialEq,
89    Eq,
90    PartialOrd,
91    Ord,
92    Hash,
93    conjure_object::serde::Deserialize,
94    conjure_object::serde::Serialize,
95)]
96#[serde(crate = "conjure_object::serde", transparent)]
97pub struct Unknown(conjure_object::private::Variant);
98impl std::ops::Deref for Unknown {
99    type Target = str;
100    #[inline]
101    fn deref(&self) -> &str {
102        &self.0
103    }
104}
105impl fmt::Display for Unknown {
106    #[inline]
107    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
108        fmt::Display::fmt(&self.0, fmt)
109    }
110}