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