Skip to main content

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