#[non_exhaustive]
pub enum OrganizationConfigRuleTriggerTypeNoSn {
ConfigurationItemChangeNotification,
OversizedConfigurationItemChangeNotifcation,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against OrganizationConfigRuleTriggerTypeNoSn, 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 organizationconfigruletriggertypenosn = unimplemented!();
match organizationconfigruletriggertypenosn {
OrganizationConfigRuleTriggerTypeNoSn::ConfigurationItemChangeNotification => { /* ... */ },
OrganizationConfigRuleTriggerTypeNoSn::OversizedConfigurationItemChangeNotifcation => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when organizationconfigruletriggertypenosn represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant OrganizationConfigRuleTriggerTypeNoSn::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
OrganizationConfigRuleTriggerTypeNoSn::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 OrganizationConfigRuleTriggerTypeNoSn::NewFeature is defined.
Specifically, when organizationconfigruletriggertypenosn represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on OrganizationConfigRuleTriggerTypeNoSn::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
ConfigurationItemChangeNotification
OversizedConfigurationItemChangeNotifcation
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl OrganizationConfigRuleTriggerTypeNoSn
impl OrganizationConfigRuleTriggerTypeNoSn
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
2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613
pub fn serialize_structure_crate_model_organization_custom_policy_rule_metadata(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::OrganizationCustomPolicyRuleMetadata,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_457) = &input.description {
object.key("Description").string(var_457.as_str());
}
if let Some(var_458) = &input.organization_config_rule_trigger_types {
let mut array_459 = object
.key("OrganizationConfigRuleTriggerTypes")
.start_array();
for item_460 in var_458 {
{
array_459.value().string(item_460.as_str());
}
}
array_459.finish();
}
if let Some(var_461) = &input.input_parameters {
object.key("InputParameters").string(var_461.as_str());
}
if let Some(var_462) = &input.maximum_execution_frequency {
object
.key("MaximumExecutionFrequency")
.string(var_462.as_str());
}
if let Some(var_463) = &input.resource_types_scope {
let mut array_464 = object.key("ResourceTypesScope").start_array();
for item_465 in var_463 {
{
array_464.value().string(item_465.as_str());
}
}
array_464.finish();
}
if let Some(var_466) = &input.resource_id_scope {
object.key("ResourceIdScope").string(var_466.as_str());
}
if let Some(var_467) = &input.tag_key_scope {
object.key("TagKeyScope").string(var_467.as_str());
}
if let Some(var_468) = &input.tag_value_scope {
object.key("TagValueScope").string(var_468.as_str());
}
if let Some(var_469) = &input.policy_runtime {
object.key("PolicyRuntime").string(var_469.as_str());
}
if let Some(var_470) = &input.policy_text {
object.key("PolicyText").string(var_470.as_str());
}
if let Some(var_471) = &input.debug_log_delivery_accounts {
let mut array_472 = object.key("DebugLogDeliveryAccounts").start_array();
for item_473 in var_471 {
{
array_472.value().string(item_473.as_str());
}
}
array_472.finish();
}
Ok(())
}Trait Implementations§
source§impl Clone for OrganizationConfigRuleTriggerTypeNoSn
impl Clone for OrganizationConfigRuleTriggerTypeNoSn
source§fn clone(&self) -> OrganizationConfigRuleTriggerTypeNoSn
fn clone(&self) -> OrganizationConfigRuleTriggerTypeNoSn
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 OrganizationConfigRuleTriggerTypeNoSn
impl From<&str> for OrganizationConfigRuleTriggerTypeNoSn
source§impl Ord for OrganizationConfigRuleTriggerTypeNoSn
impl Ord for OrganizationConfigRuleTriggerTypeNoSn
source§fn cmp(&self, other: &OrganizationConfigRuleTriggerTypeNoSn) -> Ordering
fn cmp(&self, other: &OrganizationConfigRuleTriggerTypeNoSn) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<OrganizationConfigRuleTriggerTypeNoSn> for OrganizationConfigRuleTriggerTypeNoSn
impl PartialEq<OrganizationConfigRuleTriggerTypeNoSn> for OrganizationConfigRuleTriggerTypeNoSn
source§fn eq(&self, other: &OrganizationConfigRuleTriggerTypeNoSn) -> bool
fn eq(&self, other: &OrganizationConfigRuleTriggerTypeNoSn) -> bool
source§impl PartialOrd<OrganizationConfigRuleTriggerTypeNoSn> for OrganizationConfigRuleTriggerTypeNoSn
impl PartialOrd<OrganizationConfigRuleTriggerTypeNoSn> for OrganizationConfigRuleTriggerTypeNoSn
source§fn partial_cmp(
&self,
other: &OrganizationConfigRuleTriggerTypeNoSn
) -> Option<Ordering>
fn partial_cmp(
&self,
other: &OrganizationConfigRuleTriggerTypeNoSn
) -> 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 OrganizationConfigRuleTriggerTypeNoSn
impl StructuralEq for OrganizationConfigRuleTriggerTypeNoSn
impl StructuralPartialEq for OrganizationConfigRuleTriggerTypeNoSn
Auto Trait Implementations§
impl RefUnwindSafe for OrganizationConfigRuleTriggerTypeNoSn
impl Send for OrganizationConfigRuleTriggerTypeNoSn
impl Sync for OrganizationConfigRuleTriggerTypeNoSn
impl Unpin for OrganizationConfigRuleTriggerTypeNoSn
impl UnwindSafe for OrganizationConfigRuleTriggerTypeNoSn
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.