#[non_exhaustive]
pub enum StackSetStatus {
Active,
Deleted,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against StackSetStatus, it is important to ensure
your code is forward-compatible. That is, if a match arm handles a case for a
feature that is supported by the service but has not been represented as an enum
variant in a current version of SDK, your code should continue to work when you
upgrade SDK to a future version in which the enum does include a variant for that
feature.
Here is an example of how you can make a match expression forward-compatible:
# let stacksetstatus = unimplemented!();
match stacksetstatus {
StackSetStatus::Active => { /* ... */ },
StackSetStatus::Deleted => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when stacksetstatus represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant StackSetStatus::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
StackSetStatus::Unknown(UnknownVariantValue("NewFeature".to_owned()))
and calling as_str on it yields "NewFeature".
This match expression is forward-compatible when executed with a newer
version of SDK where the variant StackSetStatus::NewFeature is defined.
Specifically, when stacksetstatus represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on StackSetStatus::NewFeature also yielding "NewFeature".
Explicitly matching on the Unknown variant should
be avoided for two reasons:
- The inner data
UnknownVariantValueis opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Active
Deleted
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl StackSetStatus
impl StackSetStatus
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the &str value of the enum member.
Examples found in repository?
More examples
1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693
pub fn serialize_operation_crate_operation_list_stack_sets(
input: &crate::input::ListStackSetsInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::error::SerializationError> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer = aws_smithy_query::QueryWriter::new(&mut out, "ListStackSets", "2010-05-15");
#[allow(unused_mut)]
let mut scope_471 = writer.prefix("NextToken");
if let Some(var_472) = &input.next_token {
scope_471.string(var_472);
}
#[allow(unused_mut)]
let mut scope_473 = writer.prefix("MaxResults");
if let Some(var_474) = &input.max_results {
scope_473.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_474).into()),
);
}
#[allow(unused_mut)]
let mut scope_475 = writer.prefix("Status");
if let Some(var_476) = &input.status {
scope_475.string(var_476.as_str());
}
#[allow(unused_mut)]
let mut scope_477 = writer.prefix("CallAs");
if let Some(var_478) = &input.call_as {
scope_477.string(var_478.as_str());
}
writer.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}Trait Implementations§
source§impl AsRef<str> for StackSetStatus
impl AsRef<str> for StackSetStatus
source§impl Clone for StackSetStatus
impl Clone for StackSetStatus
source§fn clone(&self) -> StackSetStatus
fn clone(&self) -> StackSetStatus
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for StackSetStatus
impl Debug for StackSetStatus
source§impl From<&str> for StackSetStatus
impl From<&str> for StackSetStatus
source§impl FromStr for StackSetStatus
impl FromStr for StackSetStatus
source§impl Hash for StackSetStatus
impl Hash for StackSetStatus
source§impl Ord for StackSetStatus
impl Ord for StackSetStatus
source§fn cmp(&self, other: &StackSetStatus) -> Ordering
fn cmp(&self, other: &StackSetStatus) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<StackSetStatus> for StackSetStatus
impl PartialEq<StackSetStatus> for StackSetStatus
source§fn eq(&self, other: &StackSetStatus) -> bool
fn eq(&self, other: &StackSetStatus) -> bool
source§impl PartialOrd<StackSetStatus> for StackSetStatus
impl PartialOrd<StackSetStatus> for StackSetStatus
source§fn partial_cmp(&self, other: &StackSetStatus) -> Option<Ordering>
fn partial_cmp(&self, other: &StackSetStatus) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for StackSetStatus
impl StructuralEq for StackSetStatus
impl StructuralPartialEq for StackSetStatus
Auto Trait Implementations§
impl RefUnwindSafe for StackSetStatus
impl Send for StackSetStatus
impl Sync for StackSetStatus
impl Unpin for StackSetStatus
impl UnwindSafe for StackSetStatus
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.