Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
geo3d_default_model.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 Geo3dDefaultModel {
17    #[serde(rename = "FICTIONAL_FIGHTER")]
18    FictionalFighter,
19    #[serde(rename = "SATELLITE")]
20    Satellite,
21    #[serde(rename = "QUADCOPTER")]
22    Quadcopter,
23    #[serde(rename = "FIXEDWING")]
24    Fixedwing,
25    /// An unknown variant.
26    #[serde(untagged)]
27    Unknown(Unknown),
28}
29impl Geo3dDefaultModel {
30    /// Returns the string representation of the enum.
31    #[inline]
32    pub fn as_str(&self) -> &str {
33        match self {
34            Geo3dDefaultModel::FictionalFighter => "FICTIONAL_FIGHTER",
35            Geo3dDefaultModel::Satellite => "SATELLITE",
36            Geo3dDefaultModel::Quadcopter => "QUADCOPTER",
37            Geo3dDefaultModel::Fixedwing => "FIXEDWING",
38            Geo3dDefaultModel::Unknown(v) => &*v,
39        }
40    }
41}
42impl fmt::Display for Geo3dDefaultModel {
43    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
44        fmt::Display::fmt(self.as_str(), fmt)
45    }
46}
47impl conjure_object::Plain for Geo3dDefaultModel {
48    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
49        conjure_object::Plain::fmt(self.as_str(), fmt)
50    }
51}
52impl str::FromStr for Geo3dDefaultModel {
53    type Err = conjure_object::plain::ParseEnumError;
54    #[inline]
55    fn from_str(
56        v: &str,
57    ) -> Result<Geo3dDefaultModel, conjure_object::plain::ParseEnumError> {
58        match v {
59            "FICTIONAL_FIGHTER" => Ok(Geo3dDefaultModel::FictionalFighter),
60            "SATELLITE" => Ok(Geo3dDefaultModel::Satellite),
61            "QUADCOPTER" => Ok(Geo3dDefaultModel::Quadcopter),
62            "FIXEDWING" => Ok(Geo3dDefaultModel::Fixedwing),
63            v => v.parse().map(|v| Geo3dDefaultModel::Unknown(Unknown(v))),
64        }
65    }
66}
67impl conjure_object::FromPlain for Geo3dDefaultModel {
68    type Err = conjure_object::plain::ParseEnumError;
69    #[inline]
70    fn from_plain(
71        v: &str,
72    ) -> Result<Geo3dDefaultModel, conjure_object::plain::ParseEnumError> {
73        v.parse()
74    }
75}
76///An unknown variant of the Geo3dDefaultModel enum.
77#[derive(
78    Debug,
79    Clone,
80    PartialEq,
81    Eq,
82    PartialOrd,
83    Ord,
84    Hash,
85    conjure_object::serde::Deserialize,
86    conjure_object::serde::Serialize,
87)]
88#[serde(crate = "conjure_object::serde", transparent)]
89pub struct Unknown(conjure_object::private::Variant);
90impl std::ops::Deref for Unknown {
91    type Target = str;
92    #[inline]
93    fn deref(&self) -> &str {
94        &self.0
95    }
96}
97impl fmt::Display for Unknown {
98    #[inline]
99    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
100        fmt::Display::fmt(&self.0, fmt)
101    }
102}