Skip to main content

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