nominal_api/conjure/objects/scout/compute/api/
unary_arithmetic_operation.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 UnaryArithmeticOperation {
17 #[serde(rename = "COS")]
19 Cos,
20 #[serde(rename = "SIN")]
22 Sin,
23 #[serde(rename = "TAN")]
25 Tan,
26 #[serde(rename = "ABS")]
28 Abs,
29 #[serde(rename = "ASIN")]
31 Asin,
32 #[serde(rename = "ACOS")]
34 Acos,
35 #[serde(rename = "LOG")]
37 Log,
38 #[serde(rename = "LN")]
40 Ln,
41 #[serde(rename = "SQRT")]
43 Sqrt,
44 #[serde(untagged)]
46 Unknown(Unknown),
47}
48impl UnaryArithmeticOperation {
49 #[inline]
51 pub fn as_str(&self) -> &str {
52 match self {
53 UnaryArithmeticOperation::Cos => "COS",
54 UnaryArithmeticOperation::Sin => "SIN",
55 UnaryArithmeticOperation::Tan => "TAN",
56 UnaryArithmeticOperation::Abs => "ABS",
57 UnaryArithmeticOperation::Asin => "ASIN",
58 UnaryArithmeticOperation::Acos => "ACOS",
59 UnaryArithmeticOperation::Log => "LOG",
60 UnaryArithmeticOperation::Ln => "LN",
61 UnaryArithmeticOperation::Sqrt => "SQRT",
62 UnaryArithmeticOperation::Unknown(v) => &*v,
63 }
64 }
65}
66impl fmt::Display for UnaryArithmeticOperation {
67 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
68 fmt::Display::fmt(self.as_str(), fmt)
69 }
70}
71impl conjure_object::Plain for UnaryArithmeticOperation {
72 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
73 conjure_object::Plain::fmt(self.as_str(), fmt)
74 }
75}
76impl str::FromStr for UnaryArithmeticOperation {
77 type Err = conjure_object::plain::ParseEnumError;
78 #[inline]
79 fn from_str(
80 v: &str,
81 ) -> Result<UnaryArithmeticOperation, conjure_object::plain::ParseEnumError> {
82 match v {
83 "COS" => Ok(UnaryArithmeticOperation::Cos),
84 "SIN" => Ok(UnaryArithmeticOperation::Sin),
85 "TAN" => Ok(UnaryArithmeticOperation::Tan),
86 "ABS" => Ok(UnaryArithmeticOperation::Abs),
87 "ASIN" => Ok(UnaryArithmeticOperation::Asin),
88 "ACOS" => Ok(UnaryArithmeticOperation::Acos),
89 "LOG" => Ok(UnaryArithmeticOperation::Log),
90 "LN" => Ok(UnaryArithmeticOperation::Ln),
91 "SQRT" => Ok(UnaryArithmeticOperation::Sqrt),
92 v => v.parse().map(|v| UnaryArithmeticOperation::Unknown(Unknown(v))),
93 }
94 }
95}
96impl conjure_object::FromPlain for UnaryArithmeticOperation {
97 type Err = conjure_object::plain::ParseEnumError;
98 #[inline]
99 fn from_plain(
100 v: &str,
101 ) -> Result<UnaryArithmeticOperation, conjure_object::plain::ParseEnumError> {
102 v.parse()
103 }
104}
105#[derive(
107 Debug,
108 Clone,
109 PartialEq,
110 Eq,
111 PartialOrd,
112 Ord,
113 Hash,
114 conjure_object::serde::Deserialize,
115 conjure_object::serde::Serialize,
116)]
117#[serde(crate = "conjure_object::serde", transparent)]
118pub struct Unknown(conjure_object::private::Variant);
119impl std::ops::Deref for Unknown {
120 type Target = str;
121 #[inline]
122 fn deref(&self) -> &str {
123 &self.0
124 }
125}
126impl fmt::Display for Unknown {
127 #[inline]
128 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
129 fmt::Display::fmt(&self.0, fmt)
130 }
131}