Skip to main content

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