Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
series_storage.rs

1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4/// The storage engine a series is read from. A dataset written to both Iceberg and ClickHouse can be read
5/// from either engine, and a series may name the one it wants; every other dataset is readable only from the
6/// single engine backing it, so naming the other one is an invalid request. When unset, the engine configured
7/// for the caller is used.
8#[derive(
9    Debug,
10    Clone,
11    PartialEq,
12    Eq,
13    PartialOrd,
14    Ord,
15    Hash,
16    conjure_object::serde::Deserialize,
17    conjure_object::serde::Serialize,
18)]
19#[serde(crate = "conjure_object::serde")]
20pub enum SeriesStorage {
21    #[serde(rename = "ICEBERG")]
22    Iceberg,
23    #[serde(rename = "CLICKHOUSE")]
24    Clickhouse,
25    /// An unknown variant.
26    #[serde(untagged)]
27    Unknown(Unknown),
28}
29impl SeriesStorage {
30    /// Returns the string representation of the enum.
31    #[inline]
32    pub fn as_str(&self) -> &str {
33        match self {
34            SeriesStorage::Iceberg => "ICEBERG",
35            SeriesStorage::Clickhouse => "CLICKHOUSE",
36            SeriesStorage::Unknown(v) => &*v,
37        }
38    }
39}
40impl fmt::Display for SeriesStorage {
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 SeriesStorage {
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 SeriesStorage {
51    type Err = conjure_object::plain::ParseEnumError;
52    #[inline]
53    fn from_str(
54        v: &str,
55    ) -> Result<SeriesStorage, conjure_object::plain::ParseEnumError> {
56        match v {
57            "ICEBERG" => Ok(SeriesStorage::Iceberg),
58            "CLICKHOUSE" => Ok(SeriesStorage::Clickhouse),
59            v => v.parse().map(|v| SeriesStorage::Unknown(Unknown(v))),
60        }
61    }
62}
63impl conjure_object::FromPlain for SeriesStorage {
64    type Err = conjure_object::plain::ParseEnumError;
65    #[inline]
66    fn from_plain(
67        v: &str,
68    ) -> Result<SeriesStorage, conjure_object::plain::ParseEnumError> {
69        v.parse()
70    }
71}
72///An unknown variant of the SeriesStorage enum.
73#[derive(
74    Debug,
75    Clone,
76    PartialEq,
77    Eq,
78    PartialOrd,
79    Ord,
80    Hash,
81    conjure_object::serde::Deserialize,
82    conjure_object::serde::Serialize,
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}