Skip to main content

nominal_api/conjure/objects/ingest/api/
file_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 FileOutputFormat {
17    #[serde(rename = "PARQUET")]
18    Parquet,
19    #[serde(rename = "CSV")]
20    Csv,
21    #[serde(rename = "PARQUET_TAR")]
22    ParquetTar,
23    #[serde(rename = "AVRO_STREAM")]
24    AvroStream,
25    #[serde(rename = "JSON_L")]
26    JsonL,
27    #[serde(rename = "MANIFEST")]
28    Manifest,
29    /// An unknown variant.
30    #[serde(untagged)]
31    Unknown(Unknown),
32}
33impl FileOutputFormat {
34    /// Returns the string representation of the enum.
35    #[inline]
36    pub fn as_str(&self) -> &str {
37        match self {
38            FileOutputFormat::Parquet => "PARQUET",
39            FileOutputFormat::Csv => "CSV",
40            FileOutputFormat::ParquetTar => "PARQUET_TAR",
41            FileOutputFormat::AvroStream => "AVRO_STREAM",
42            FileOutputFormat::JsonL => "JSON_L",
43            FileOutputFormat::Manifest => "MANIFEST",
44            FileOutputFormat::Unknown(v) => &*v,
45        }
46    }
47}
48impl fmt::Display for FileOutputFormat {
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 FileOutputFormat {
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 FileOutputFormat {
59    type Err = conjure_object::plain::ParseEnumError;
60    #[inline]
61    fn from_str(
62        v: &str,
63    ) -> Result<FileOutputFormat, conjure_object::plain::ParseEnumError> {
64        match v {
65            "PARQUET" => Ok(FileOutputFormat::Parquet),
66            "CSV" => Ok(FileOutputFormat::Csv),
67            "PARQUET_TAR" => Ok(FileOutputFormat::ParquetTar),
68            "AVRO_STREAM" => Ok(FileOutputFormat::AvroStream),
69            "JSON_L" => Ok(FileOutputFormat::JsonL),
70            "MANIFEST" => Ok(FileOutputFormat::Manifest),
71            v => v.parse().map(|v| FileOutputFormat::Unknown(Unknown(v))),
72        }
73    }
74}
75impl conjure_object::FromPlain for FileOutputFormat {
76    type Err = conjure_object::plain::ParseEnumError;
77    #[inline]
78    fn from_plain(
79        v: &str,
80    ) -> Result<FileOutputFormat, conjure_object::plain::ParseEnumError> {
81        v.parse()
82    }
83}
84///An unknown variant of the FileOutputFormat 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}