nominal_api_conjure/conjure/objects/api/
archived_status.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 ArchivedStatus {
18 #[serde(rename = "NOT_ARCHIVED")]
19 NotArchived,
20 #[serde(rename = "ARCHIVED")]
21 Archived,
22 #[serde(untagged)]
24 Unknown(Unknown),
25}
26impl ArchivedStatus {
27 #[inline]
29 pub fn as_str(&self) -> &str {
30 match self {
31 ArchivedStatus::NotArchived => "NOT_ARCHIVED",
32 ArchivedStatus::Archived => "ARCHIVED",
33 ArchivedStatus::Unknown(v) => &*v,
34 }
35 }
36}
37impl fmt::Display for ArchivedStatus {
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 ArchivedStatus {
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 ArchivedStatus {
48 type Err = conjure_object::plain::ParseEnumError;
49 #[inline]
50 fn from_str(
51 v: &str,
52 ) -> Result<ArchivedStatus, conjure_object::plain::ParseEnumError> {
53 match v {
54 "NOT_ARCHIVED" => Ok(ArchivedStatus::NotArchived),
55 "ARCHIVED" => Ok(ArchivedStatus::Archived),
56 v => v.parse().map(|v| ArchivedStatus::Unknown(Unknown(v))),
57 }
58 }
59}
60impl conjure_object::FromPlain for ArchivedStatus {
61 type Err = conjure_object::plain::ParseEnumError;
62 #[inline]
63 fn from_plain(
64 v: &str,
65 ) -> Result<ArchivedStatus, 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}