Skip to main content

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