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