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