Skip to main content

nominal_api/conjure/objects/scout/compute/api/
binary_arithmetic_operation.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 BinaryArithmeticOperation {
17    /// Calculates the angle measure between the x-axis and a ray from the origin to a point (input2, input1)
18    /// in radians.
19    /// Note the order of arguments.
20    #[serde(rename = "ATAN2")]
21    Atan2,
22    /// An unknown variant.
23    #[serde(untagged)]
24    Unknown(Unknown),
25}
26impl BinaryArithmeticOperation {
27    /// Returns the string representation of the enum.
28    #[inline]
29    pub fn as_str(&self) -> &str {
30        match self {
31            BinaryArithmeticOperation::Atan2 => "ATAN2",
32            BinaryArithmeticOperation::Unknown(v) => &*v,
33        }
34    }
35}
36impl fmt::Display for BinaryArithmeticOperation {
37    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
38        fmt::Display::fmt(self.as_str(), fmt)
39    }
40}
41impl conjure_object::Plain for BinaryArithmeticOperation {
42    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
43        conjure_object::Plain::fmt(self.as_str(), fmt)
44    }
45}
46impl str::FromStr for BinaryArithmeticOperation {
47    type Err = conjure_object::plain::ParseEnumError;
48    #[inline]
49    fn from_str(
50        v: &str,
51    ) -> Result<BinaryArithmeticOperation, conjure_object::plain::ParseEnumError> {
52        match v {
53            "ATAN2" => Ok(BinaryArithmeticOperation::Atan2),
54            v => v.parse().map(|v| BinaryArithmeticOperation::Unknown(Unknown(v))),
55        }
56    }
57}
58impl conjure_object::FromPlain for BinaryArithmeticOperation {
59    type Err = conjure_object::plain::ParseEnumError;
60    #[inline]
61    fn from_plain(
62        v: &str,
63    ) -> Result<BinaryArithmeticOperation, conjure_object::plain::ParseEnumError> {
64        v.parse()
65    }
66}
67///An unknown variant of the BinaryArithmeticOperation 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}