Skip to main content

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