aws_sdk_appflow/types/
_singular_connector_operator.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// When writing a match expression against `SingularConnectorOperator`, it is important to ensure
4/// your code is forward-compatible. That is, if a match arm handles a case for a
5/// feature that is supported by the service but has not been represented as an enum
6/// variant in a current version of SDK, your code should continue to work when you
7/// upgrade SDK to a future version in which the enum does include a variant for that
8/// feature.
9///
10/// Here is an example of how you can make a match expression forward-compatible:
11///
12/// ```text
13/// # let singularconnectoroperator = unimplemented!();
14/// match singularconnectoroperator {
15///     SingularConnectorOperator::Addition => { /* ... */ },
16///     SingularConnectorOperator::Division => { /* ... */ },
17///     SingularConnectorOperator::EqualTo => { /* ... */ },
18///     SingularConnectorOperator::MaskAll => { /* ... */ },
19///     SingularConnectorOperator::MaskFirstN => { /* ... */ },
20///     SingularConnectorOperator::MaskLastN => { /* ... */ },
21///     SingularConnectorOperator::Multiplication => { /* ... */ },
22///     SingularConnectorOperator::NoOp => { /* ... */ },
23///     SingularConnectorOperator::Projection => { /* ... */ },
24///     SingularConnectorOperator::Subtraction => { /* ... */ },
25///     SingularConnectorOperator::ValidateNonNegative => { /* ... */ },
26///     SingularConnectorOperator::ValidateNonNull => { /* ... */ },
27///     SingularConnectorOperator::ValidateNonZero => { /* ... */ },
28///     SingularConnectorOperator::ValidateNumeric => { /* ... */ },
29///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
30///     _ => { /* ... */ },
31/// }
32/// ```
33/// The above code demonstrates that when `singularconnectoroperator` represents
34/// `NewFeature`, the execution path will lead to the second last match arm,
35/// even though the enum does not contain a variant `SingularConnectorOperator::NewFeature`
36/// in the current version of SDK. The reason is that the variable `other`,
37/// created by the `@` operator, is bound to
38/// `SingularConnectorOperator::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
39/// and calling `as_str` on it yields `"NewFeature"`.
40/// This match expression is forward-compatible when executed with a newer
41/// version of SDK where the variant `SingularConnectorOperator::NewFeature` is defined.
42/// Specifically, when `singularconnectoroperator` represents `NewFeature`,
43/// the execution path will hit the second last match arm as before by virtue of
44/// calling `as_str` on `SingularConnectorOperator::NewFeature` also yielding `"NewFeature"`.
45///
46/// Explicitly matching on the `Unknown` variant should
47/// be avoided for two reasons:
48/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
49/// - It might inadvertently shadow other intended match arms.
50///
51#[allow(missing_docs)] // documentation missing in model
52#[non_exhaustive]
53#[derive(
54    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
55)]
56pub enum SingularConnectorOperator {
57    #[allow(missing_docs)] // documentation missing in model
58    Addition,
59    #[allow(missing_docs)] // documentation missing in model
60    Division,
61    #[allow(missing_docs)] // documentation missing in model
62    EqualTo,
63    #[allow(missing_docs)] // documentation missing in model
64    MaskAll,
65    #[allow(missing_docs)] // documentation missing in model
66    MaskFirstN,
67    #[allow(missing_docs)] // documentation missing in model
68    MaskLastN,
69    #[allow(missing_docs)] // documentation missing in model
70    Multiplication,
71    #[allow(missing_docs)] // documentation missing in model
72    NoOp,
73    #[allow(missing_docs)] // documentation missing in model
74    Projection,
75    #[allow(missing_docs)] // documentation missing in model
76    Subtraction,
77    #[allow(missing_docs)] // documentation missing in model
78    ValidateNonNegative,
79    #[allow(missing_docs)] // documentation missing in model
80    ValidateNonNull,
81    #[allow(missing_docs)] // documentation missing in model
82    ValidateNonZero,
83    #[allow(missing_docs)] // documentation missing in model
84    ValidateNumeric,
85    /// `Unknown` contains new variants that have been added since this code was generated.
86    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
87    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
88}
89impl ::std::convert::From<&str> for SingularConnectorOperator {
90    fn from(s: &str) -> Self {
91        match s {
92            "ADDITION" => SingularConnectorOperator::Addition,
93            "DIVISION" => SingularConnectorOperator::Division,
94            "EQUAL_TO" => SingularConnectorOperator::EqualTo,
95            "MASK_ALL" => SingularConnectorOperator::MaskAll,
96            "MASK_FIRST_N" => SingularConnectorOperator::MaskFirstN,
97            "MASK_LAST_N" => SingularConnectorOperator::MaskLastN,
98            "MULTIPLICATION" => SingularConnectorOperator::Multiplication,
99            "NO_OP" => SingularConnectorOperator::NoOp,
100            "PROJECTION" => SingularConnectorOperator::Projection,
101            "SUBTRACTION" => SingularConnectorOperator::Subtraction,
102            "VALIDATE_NON_NEGATIVE" => SingularConnectorOperator::ValidateNonNegative,
103            "VALIDATE_NON_NULL" => SingularConnectorOperator::ValidateNonNull,
104            "VALIDATE_NON_ZERO" => SingularConnectorOperator::ValidateNonZero,
105            "VALIDATE_NUMERIC" => SingularConnectorOperator::ValidateNumeric,
106            other => SingularConnectorOperator::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
107        }
108    }
109}
110impl ::std::str::FromStr for SingularConnectorOperator {
111    type Err = ::std::convert::Infallible;
112
113    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
114        ::std::result::Result::Ok(SingularConnectorOperator::from(s))
115    }
116}
117impl SingularConnectorOperator {
118    /// Returns the `&str` value of the enum member.
119    pub fn as_str(&self) -> &str {
120        match self {
121            SingularConnectorOperator::Addition => "ADDITION",
122            SingularConnectorOperator::Division => "DIVISION",
123            SingularConnectorOperator::EqualTo => "EQUAL_TO",
124            SingularConnectorOperator::MaskAll => "MASK_ALL",
125            SingularConnectorOperator::MaskFirstN => "MASK_FIRST_N",
126            SingularConnectorOperator::MaskLastN => "MASK_LAST_N",
127            SingularConnectorOperator::Multiplication => "MULTIPLICATION",
128            SingularConnectorOperator::NoOp => "NO_OP",
129            SingularConnectorOperator::Projection => "PROJECTION",
130            SingularConnectorOperator::Subtraction => "SUBTRACTION",
131            SingularConnectorOperator::ValidateNonNegative => "VALIDATE_NON_NEGATIVE",
132            SingularConnectorOperator::ValidateNonNull => "VALIDATE_NON_NULL",
133            SingularConnectorOperator::ValidateNonZero => "VALIDATE_NON_ZERO",
134            SingularConnectorOperator::ValidateNumeric => "VALIDATE_NUMERIC",
135            SingularConnectorOperator::Unknown(value) => value.as_str(),
136        }
137    }
138    /// Returns all the `&str` representations of the enum members.
139    pub const fn values() -> &'static [&'static str] {
140        &[
141            "ADDITION",
142            "DIVISION",
143            "EQUAL_TO",
144            "MASK_ALL",
145            "MASK_FIRST_N",
146            "MASK_LAST_N",
147            "MULTIPLICATION",
148            "NO_OP",
149            "PROJECTION",
150            "SUBTRACTION",
151            "VALIDATE_NON_NEGATIVE",
152            "VALIDATE_NON_NULL",
153            "VALIDATE_NON_ZERO",
154            "VALIDATE_NUMERIC",
155        ]
156    }
157}
158impl ::std::convert::AsRef<str> for SingularConnectorOperator {
159    fn as_ref(&self) -> &str {
160        self.as_str()
161    }
162}
163impl SingularConnectorOperator {
164    /// Parses the enum value while disallowing unknown variants.
165    ///
166    /// Unknown variants will result in an error.
167    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
168        match Self::from(value) {
169            #[allow(deprecated)]
170            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
171            known => Ok(known),
172        }
173    }
174}
175impl ::std::fmt::Display for SingularConnectorOperator {
176    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
177        match self {
178            SingularConnectorOperator::Addition => write!(f, "ADDITION"),
179            SingularConnectorOperator::Division => write!(f, "DIVISION"),
180            SingularConnectorOperator::EqualTo => write!(f, "EQUAL_TO"),
181            SingularConnectorOperator::MaskAll => write!(f, "MASK_ALL"),
182            SingularConnectorOperator::MaskFirstN => write!(f, "MASK_FIRST_N"),
183            SingularConnectorOperator::MaskLastN => write!(f, "MASK_LAST_N"),
184            SingularConnectorOperator::Multiplication => write!(f, "MULTIPLICATION"),
185            SingularConnectorOperator::NoOp => write!(f, "NO_OP"),
186            SingularConnectorOperator::Projection => write!(f, "PROJECTION"),
187            SingularConnectorOperator::Subtraction => write!(f, "SUBTRACTION"),
188            SingularConnectorOperator::ValidateNonNegative => write!(f, "VALIDATE_NON_NEGATIVE"),
189            SingularConnectorOperator::ValidateNonNull => write!(f, "VALIDATE_NON_NULL"),
190            SingularConnectorOperator::ValidateNonZero => write!(f, "VALIDATE_NON_ZERO"),
191            SingularConnectorOperator::ValidateNumeric => write!(f, "VALIDATE_NUMERIC"),
192            SingularConnectorOperator::Unknown(value) => write!(f, "{value}"),
193        }
194    }
195}