Enum aws_sdk_emr::model::ReconfigurationType
source · #[non_exhaustive]
pub enum ReconfigurationType {
Merge,
Overwrite,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against ReconfigurationType, 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 reconfigurationtype = unimplemented!();
match reconfigurationtype {
ReconfigurationType::Merge => { /* ... */ },
ReconfigurationType::Overwrite => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when reconfigurationtype represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant ReconfigurationType::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
ReconfigurationType::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 ReconfigurationType::NewFeature is defined.
Specifically, when reconfigurationtype represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on ReconfigurationType::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
Merge
Overwrite
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl ReconfigurationType
impl ReconfigurationType
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
1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423
pub fn serialize_structure_crate_model_instance_group_modify_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::InstanceGroupModifyConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_279) = &input.instance_group_id {
object.key("InstanceGroupId").string(var_279.as_str());
}
if let Some(var_280) = &input.instance_count {
object.key("InstanceCount").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_280).into()),
);
}
if let Some(var_281) = &input.ec2_instance_ids_to_terminate {
let mut array_282 = object.key("EC2InstanceIdsToTerminate").start_array();
for item_283 in var_281 {
{
array_282.value().string(item_283.as_str());
}
}
array_282.finish();
}
if let Some(var_284) = &input.shrink_policy {
#[allow(unused_mut)]
let mut object_285 = object.key("ShrinkPolicy").start_object();
crate::json_ser::serialize_structure_crate_model_shrink_policy(&mut object_285, var_284)?;
object_285.finish();
}
if let Some(var_286) = &input.reconfiguration_type {
object.key("ReconfigurationType").string(var_286.as_str());
}
if let Some(var_287) = &input.configurations {
let mut array_288 = object.key("Configurations").start_array();
for item_289 in var_287 {
{
#[allow(unused_mut)]
let mut object_290 = array_288.value().start_object();
crate::json_ser::serialize_structure_crate_model_configuration(
&mut object_290,
item_289,
)?;
object_290.finish();
}
}
array_288.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for ReconfigurationType
impl AsRef<str> for ReconfigurationType
source§impl Clone for ReconfigurationType
impl Clone for ReconfigurationType
source§fn clone(&self) -> ReconfigurationType
fn clone(&self) -> ReconfigurationType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ReconfigurationType
impl Debug for ReconfigurationType
source§impl From<&str> for ReconfigurationType
impl From<&str> for ReconfigurationType
source§impl FromStr for ReconfigurationType
impl FromStr for ReconfigurationType
source§impl Hash for ReconfigurationType
impl Hash for ReconfigurationType
source§impl Ord for ReconfigurationType
impl Ord for ReconfigurationType
source§fn cmp(&self, other: &ReconfigurationType) -> Ordering
fn cmp(&self, other: &ReconfigurationType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ReconfigurationType> for ReconfigurationType
impl PartialEq<ReconfigurationType> for ReconfigurationType
source§fn eq(&self, other: &ReconfigurationType) -> bool
fn eq(&self, other: &ReconfigurationType) -> bool
source§impl PartialOrd<ReconfigurationType> for ReconfigurationType
impl PartialOrd<ReconfigurationType> for ReconfigurationType
source§fn partial_cmp(&self, other: &ReconfigurationType) -> Option<Ordering>
fn partial_cmp(&self, other: &ReconfigurationType) -> 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 ReconfigurationType
impl StructuralEq for ReconfigurationType
impl StructuralPartialEq for ReconfigurationType
Auto Trait Implementations§
impl RefUnwindSafe for ReconfigurationType
impl Send for ReconfigurationType
impl Sync for ReconfigurationType
impl Unpin for ReconfigurationType
impl UnwindSafe for ReconfigurationType
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.