Skip to main content

nominal_api/conjure/objects/scout/workbookcommon/api/
event_align_to.rs

1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4/// The align to value for an event offset. If the queried event is a moment, the offset will be the moment timestamp regardless of the align to value.
5#[derive(
6    Debug,
7    Clone,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash,
13    conjure_object::serde::Deserialize,
14    conjure_object::serde::Serialize,
15)]
16#[serde(crate = "conjure_object::serde")]
17pub enum EventAlignTo {
18    #[serde(rename = "START")]
19    Start,
20    #[serde(rename = "END")]
21    End,
22    /// An unknown variant.
23    #[serde(untagged)]
24    Unknown(Unknown),
25}
26impl EventAlignTo {
27    /// Returns the string representation of the enum.
28    #[inline]
29    pub fn as_str(&self) -> &str {
30        match self {
31            EventAlignTo::Start => "START",
32            EventAlignTo::End => "END",
33            EventAlignTo::Unknown(v) => &*v,
34        }
35    }
36}
37impl fmt::Display for EventAlignTo {
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 EventAlignTo {
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 EventAlignTo {
48    type Err = conjure_object::plain::ParseEnumError;
49    #[inline]
50    fn from_str(v: &str) -> Result<EventAlignTo, conjure_object::plain::ParseEnumError> {
51        match v {
52            "START" => Ok(EventAlignTo::Start),
53            "END" => Ok(EventAlignTo::End),
54            v => v.parse().map(|v| EventAlignTo::Unknown(Unknown(v))),
55        }
56    }
57}
58impl conjure_object::FromPlain for EventAlignTo {
59    type Err = conjure_object::plain::ParseEnumError;
60    #[inline]
61    fn from_plain(
62        v: &str,
63    ) -> Result<EventAlignTo, conjure_object::plain::ParseEnumError> {
64        v.parse()
65    }
66}
67///An unknown variant of the EventAlignTo enum.
68#[derive(
69    Debug,
70    Clone,
71    PartialEq,
72    Eq,
73    PartialOrd,
74    Ord,
75    Hash,
76    conjure_object::serde::Deserialize,
77    conjure_object::serde::Serialize,
78)]
79#[serde(crate = "conjure_object::serde", transparent)]
80pub struct Unknown(conjure_object::private::Variant);
81impl std::ops::Deref for Unknown {
82    type Target = str;
83    #[inline]
84    fn deref(&self) -> &str {
85        &self.0
86    }
87}
88impl fmt::Display for Unknown {
89    #[inline]
90    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
91        fmt::Display::fmt(&self.0, fmt)
92    }
93}