Enum aws_sdk_dynamodb::model::BackupTypeFilter
source · #[non_exhaustive]
pub enum BackupTypeFilter {
All,
AwsBackup,
System,
User,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against BackupTypeFilter
, 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 backuptypefilter = unimplemented!();
match backuptypefilter {
BackupTypeFilter::All => { /* ... */ },
BackupTypeFilter::AwsBackup => { /* ... */ },
BackupTypeFilter::System => { /* ... */ },
BackupTypeFilter::User => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when backuptypefilter
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant BackupTypeFilter::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
BackupTypeFilter::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 BackupTypeFilter::NewFeature
is defined.
Specifically, when backuptypefilter
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on BackupTypeFilter::NewFeature
also yielding "NewFeature"
.
Explicitly matching on the Unknown
variant should
be avoided for two reasons:
- The inner data
UnknownVariantValue
is 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
All
AwsBackup
System
User
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl BackupTypeFilter
impl BackupTypeFilter
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
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
pub fn serialize_structure_crate_input_list_backups_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::ListBackupsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_149) = &input.table_name {
object.key("TableName").string(var_149.as_str());
}
if let Some(var_150) = &input.limit {
object.key("Limit").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_150).into()),
);
}
if let Some(var_151) = &input.time_range_lower_bound {
object
.key("TimeRangeLowerBound")
.date_time(var_151, aws_smithy_types::date_time::Format::EpochSeconds)?;
}
if let Some(var_152) = &input.time_range_upper_bound {
object
.key("TimeRangeUpperBound")
.date_time(var_152, aws_smithy_types::date_time::Format::EpochSeconds)?;
}
if let Some(var_153) = &input.exclusive_start_backup_arn {
object
.key("ExclusiveStartBackupArn")
.string(var_153.as_str());
}
if let Some(var_154) = &input.backup_type {
object.key("BackupType").string(var_154.as_str());
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for BackupTypeFilter
impl AsRef<str> for BackupTypeFilter
source§impl Clone for BackupTypeFilter
impl Clone for BackupTypeFilter
source§fn clone(&self) -> BackupTypeFilter
fn clone(&self) -> BackupTypeFilter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BackupTypeFilter
impl Debug for BackupTypeFilter
source§impl From<&str> for BackupTypeFilter
impl From<&str> for BackupTypeFilter
source§impl FromStr for BackupTypeFilter
impl FromStr for BackupTypeFilter
source§impl Hash for BackupTypeFilter
impl Hash for BackupTypeFilter
source§impl Ord for BackupTypeFilter
impl Ord for BackupTypeFilter
source§fn cmp(&self, other: &BackupTypeFilter) -> Ordering
fn cmp(&self, other: &BackupTypeFilter) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<BackupTypeFilter> for BackupTypeFilter
impl PartialEq<BackupTypeFilter> for BackupTypeFilter
source§fn eq(&self, other: &BackupTypeFilter) -> bool
fn eq(&self, other: &BackupTypeFilter) -> bool
source§impl PartialOrd<BackupTypeFilter> for BackupTypeFilter
impl PartialOrd<BackupTypeFilter> for BackupTypeFilter
source§fn partial_cmp(&self, other: &BackupTypeFilter) -> Option<Ordering>
fn partial_cmp(&self, other: &BackupTypeFilter) -> 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 BackupTypeFilter
impl StructuralEq for BackupTypeFilter
impl StructuralPartialEq for BackupTypeFilter
Auto Trait Implementations§
impl RefUnwindSafe for BackupTypeFilter
impl Send for BackupTypeFilter
impl Sync for BackupTypeFilter
impl Unpin for BackupTypeFilter
impl UnwindSafe for BackupTypeFilter
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.