Skip to main content

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