Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
numeric_multivariate_aggregation.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    conjure_object::log_safety::derive::LogSafe
15)]
16#[serde(crate = "conjure_object::serde")]
17pub enum NumericMultivariateAggregation {
18    #[serde(rename = "MEAN")]
19    Mean,
20    #[serde(rename = "MIN")]
21    Min,
22    #[serde(rename = "MAX")]
23    Max,
24    #[serde(rename = "FIRST")]
25    First,
26    #[serde(rename = "LAST")]
27    Last,
28    /// An unknown variant.
29    #[serde(untagged)]
30    Unknown(Unknown),
31}
32impl NumericMultivariateAggregation {
33    /// Returns the string representation of the enum.
34    #[inline]
35    pub fn as_str(&self) -> &str {
36        match self {
37            NumericMultivariateAggregation::Mean => "MEAN",
38            NumericMultivariateAggregation::Min => "MIN",
39            NumericMultivariateAggregation::Max => "MAX",
40            NumericMultivariateAggregation::First => "FIRST",
41            NumericMultivariateAggregation::Last => "LAST",
42            NumericMultivariateAggregation::Unknown(v) => &*v,
43        }
44    }
45}
46impl fmt::Display for NumericMultivariateAggregation {
47    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
48        fmt::Display::fmt(self.as_str(), fmt)
49    }
50}
51impl conjure_object::Plain for NumericMultivariateAggregation {
52    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
53        conjure_object::Plain::fmt(self.as_str(), fmt)
54    }
55}
56impl str::FromStr for NumericMultivariateAggregation {
57    type Err = conjure_object::plain::ParseEnumError;
58    #[inline]
59    fn from_str(
60        v: &str,
61    ) -> Result<NumericMultivariateAggregation, conjure_object::plain::ParseEnumError> {
62        match v {
63            "MEAN" => Ok(NumericMultivariateAggregation::Mean),
64            "MIN" => Ok(NumericMultivariateAggregation::Min),
65            "MAX" => Ok(NumericMultivariateAggregation::Max),
66            "FIRST" => Ok(NumericMultivariateAggregation::First),
67            "LAST" => Ok(NumericMultivariateAggregation::Last),
68            v => v.parse().map(|v| NumericMultivariateAggregation::Unknown(Unknown(v))),
69        }
70    }
71}
72impl conjure_object::FromPlain for NumericMultivariateAggregation {
73    type Err = conjure_object::plain::ParseEnumError;
74    #[inline]
75    fn from_plain(
76        v: &str,
77    ) -> Result<NumericMultivariateAggregation, conjure_object::plain::ParseEnumError> {
78        v.parse()
79    }
80}
81///An unknown variant of the NumericMultivariateAggregation enum.
82#[derive(
83    Debug,
84    Clone,
85    PartialEq,
86    Eq,
87    PartialOrd,
88    Ord,
89    Hash,
90    conjure_object::serde::Deserialize,
91    conjure_object::serde::Serialize,
92    conjure_object::log_safety::derive::LogSafe,
93)]
94#[serde(crate = "conjure_object::serde", transparent)]
95pub struct Unknown(conjure_object::private::Variant);
96impl std::ops::Deref for Unknown {
97    type Target = str;
98    #[inline]
99    fn deref(&self) -> &str {
100        &self.0
101    }
102}
103impl fmt::Display for Unknown {
104    #[inline]
105    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
106        fmt::Display::fmt(&self.0, fmt)
107    }
108}