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