#[non_exhaustive]
pub enum ConformancePackComplianceType {
Compliant,
InsufficientData,
NonCompliant,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against ConformancePackComplianceType, 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 conformancepackcompliancetype = unimplemented!();
match conformancepackcompliancetype {
ConformancePackComplianceType::Compliant => { /* ... */ },
ConformancePackComplianceType::InsufficientData => { /* ... */ },
ConformancePackComplianceType::NonCompliant => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when conformancepackcompliancetype represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant ConformancePackComplianceType::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
ConformancePackComplianceType::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 ConformancePackComplianceType::NewFeature is defined.
Specifically, when conformancepackcompliancetype represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on ConformancePackComplianceType::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
Compliant
InsufficientData
NonCompliant
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl ConformancePackComplianceType
impl ConformancePackComplianceType
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
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161
pub fn serialize_structure_crate_model_aggregate_conformance_pack_compliance_filters(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::AggregateConformancePackComplianceFilters,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_351) = &input.conformance_pack_name {
object.key("ConformancePackName").string(var_351.as_str());
}
if let Some(var_352) = &input.compliance_type {
object.key("ComplianceType").string(var_352.as_str());
}
if let Some(var_353) = &input.account_id {
object.key("AccountId").string(var_353.as_str());
}
if let Some(var_354) = &input.aws_region {
object.key("AwsRegion").string(var_354.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_conformance_pack_compliance_filters(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ConformancePackComplianceFilters,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_355) = &input.config_rule_names {
let mut array_356 = object.key("ConfigRuleNames").start_array();
for item_357 in var_355 {
{
array_356.value().string(item_357.as_str());
}
}
array_356.finish();
}
if let Some(var_358) = &input.compliance_type {
object.key("ComplianceType").string(var_358.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_config_rule_compliance_summary_filters(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ConfigRuleComplianceSummaryFilters,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_359) = &input.account_id {
object.key("AccountId").string(var_359.as_str());
}
if let Some(var_360) = &input.aws_region {
object.key("AwsRegion").string(var_360.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_aggregate_conformance_pack_compliance_summary_filters(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::AggregateConformancePackComplianceSummaryFilters,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_361) = &input.account_id {
object.key("AccountId").string(var_361.as_str());
}
if let Some(var_362) = &input.aws_region {
object.key("AwsRegion").string(var_362.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_resource_count_filters(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ResourceCountFilters,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_363) = &input.resource_type {
object.key("ResourceType").string(var_363.as_str());
}
if let Some(var_364) = &input.account_id {
object.key("AccountId").string(var_364.as_str());
}
if let Some(var_365) = &input.region {
object.key("Region").string(var_365.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_conformance_pack_evaluation_filters(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ConformancePackEvaluationFilters,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_366) = &input.config_rule_names {
let mut array_367 = object.key("ConfigRuleNames").start_array();
for item_368 in var_366 {
{
array_367.value().string(item_368.as_str());
}
}
array_367.finish();
}
if let Some(var_369) = &input.compliance_type {
object.key("ComplianceType").string(var_369.as_str());
}
if let Some(var_370) = &input.resource_type {
object.key("ResourceType").string(var_370.as_str());
}
if let Some(var_371) = &input.resource_ids {
let mut array_372 = object.key("ResourceIds").start_array();
for item_373 in var_371 {
{
array_372.value().string(item_373.as_str());
}
}
array_372.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for ConformancePackComplianceType
impl AsRef<str> for ConformancePackComplianceType
source§impl Clone for ConformancePackComplianceType
impl Clone for ConformancePackComplianceType
source§fn clone(&self) -> ConformancePackComplianceType
fn clone(&self) -> ConformancePackComplianceType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl From<&str> for ConformancePackComplianceType
impl From<&str> for ConformancePackComplianceType
source§impl Hash for ConformancePackComplianceType
impl Hash for ConformancePackComplianceType
source§impl Ord for ConformancePackComplianceType
impl Ord for ConformancePackComplianceType
source§fn cmp(&self, other: &ConformancePackComplianceType) -> Ordering
fn cmp(&self, other: &ConformancePackComplianceType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ConformancePackComplianceType> for ConformancePackComplianceType
impl PartialEq<ConformancePackComplianceType> for ConformancePackComplianceType
source§fn eq(&self, other: &ConformancePackComplianceType) -> bool
fn eq(&self, other: &ConformancePackComplianceType) -> bool
source§impl PartialOrd<ConformancePackComplianceType> for ConformancePackComplianceType
impl PartialOrd<ConformancePackComplianceType> for ConformancePackComplianceType
source§fn partial_cmp(&self, other: &ConformancePackComplianceType) -> Option<Ordering>
fn partial_cmp(&self, other: &ConformancePackComplianceType) -> 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 ConformancePackComplianceType
impl StructuralEq for ConformancePackComplianceType
impl StructuralPartialEq for ConformancePackComplianceType
Auto Trait Implementations§
impl RefUnwindSafe for ConformancePackComplianceType
impl Send for ConformancePackComplianceType
impl Sync for ConformancePackComplianceType
impl Unpin for ConformancePackComplianceType
impl UnwindSafe for ConformancePackComplianceType
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.