#[non_exhaustive]
pub enum UpdateActionStatus {
Complete,
InProgress,
NotApplicable,
NotApplied,
Scheduled,
Scheduling,
Stopped,
Stopping,
WaitingToStart,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against UpdateActionStatus
, 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 updateactionstatus = unimplemented!();
match updateactionstatus {
UpdateActionStatus::Complete => { /* ... */ },
UpdateActionStatus::InProgress => { /* ... */ },
UpdateActionStatus::NotApplicable => { /* ... */ },
UpdateActionStatus::NotApplied => { /* ... */ },
UpdateActionStatus::Scheduled => { /* ... */ },
UpdateActionStatus::Scheduling => { /* ... */ },
UpdateActionStatus::Stopped => { /* ... */ },
UpdateActionStatus::Stopping => { /* ... */ },
UpdateActionStatus::WaitingToStart => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when updateactionstatus
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant UpdateActionStatus::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
UpdateActionStatus::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 UpdateActionStatus::NewFeature
is defined.
Specifically, when updateactionstatus
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on UpdateActionStatus::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
Complete
InProgress
NotApplicable
NotApplied
Scheduled
Scheduling
Stopped
Stopping
WaitingToStart
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl UpdateActionStatus
impl UpdateActionStatus
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
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826
pub fn serialize_operation_crate_operation_describe_update_actions(
input: &crate::input::DescribeUpdateActionsInput,
) -> 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, "DescribeUpdateActions", "2015-02-02");
#[allow(unused_mut)]
let mut scope_500 = writer.prefix("ServiceUpdateName");
if let Some(var_501) = &input.service_update_name {
scope_500.string(var_501);
}
#[allow(unused_mut)]
let mut scope_502 = writer.prefix("ReplicationGroupIds");
if let Some(var_503) = &input.replication_group_ids {
let mut list_505 = scope_502.start_list(false, None);
for item_504 in var_503 {
#[allow(unused_mut)]
let mut entry_506 = list_505.entry();
entry_506.string(item_504);
}
list_505.finish();
}
#[allow(unused_mut)]
let mut scope_507 = writer.prefix("CacheClusterIds");
if let Some(var_508) = &input.cache_cluster_ids {
let mut list_510 = scope_507.start_list(false, None);
for item_509 in var_508 {
#[allow(unused_mut)]
let mut entry_511 = list_510.entry();
entry_511.string(item_509);
}
list_510.finish();
}
#[allow(unused_mut)]
let mut scope_512 = writer.prefix("Engine");
if let Some(var_513) = &input.engine {
scope_512.string(var_513);
}
#[allow(unused_mut)]
let mut scope_514 = writer.prefix("ServiceUpdateStatus");
if let Some(var_515) = &input.service_update_status {
let mut list_517 = scope_514.start_list(false, None);
for item_516 in var_515 {
#[allow(unused_mut)]
let mut entry_518 = list_517.entry();
entry_518.string(item_516.as_str());
}
list_517.finish();
}
#[allow(unused_mut)]
let mut scope_519 = writer.prefix("ServiceUpdateTimeRange");
if let Some(var_520) = &input.service_update_time_range {
crate::query_ser::serialize_structure_crate_model_time_range_filter(scope_519, var_520)?;
}
#[allow(unused_mut)]
let mut scope_521 = writer.prefix("UpdateActionStatus");
if let Some(var_522) = &input.update_action_status {
let mut list_524 = scope_521.start_list(false, None);
for item_523 in var_522 {
#[allow(unused_mut)]
let mut entry_525 = list_524.entry();
entry_525.string(item_523.as_str());
}
list_524.finish();
}
#[allow(unused_mut)]
let mut scope_526 = writer.prefix("ShowNodeLevelUpdateStatus");
if let Some(var_527) = &input.show_node_level_update_status {
scope_526.boolean(*var_527);
}
#[allow(unused_mut)]
let mut scope_528 = writer.prefix("MaxRecords");
if let Some(var_529) = &input.max_records {
scope_528.number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_529).into()),
);
}
#[allow(unused_mut)]
let mut scope_530 = writer.prefix("Marker");
if let Some(var_531) = &input.marker {
scope_530.string(var_531);
}
writer.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
Trait Implementations§
source§impl AsRef<str> for UpdateActionStatus
impl AsRef<str> for UpdateActionStatus
source§impl Clone for UpdateActionStatus
impl Clone for UpdateActionStatus
source§fn clone(&self) -> UpdateActionStatus
fn clone(&self) -> UpdateActionStatus
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for UpdateActionStatus
impl Debug for UpdateActionStatus
source§impl From<&str> for UpdateActionStatus
impl From<&str> for UpdateActionStatus
source§impl FromStr for UpdateActionStatus
impl FromStr for UpdateActionStatus
source§impl Hash for UpdateActionStatus
impl Hash for UpdateActionStatus
source§impl Ord for UpdateActionStatus
impl Ord for UpdateActionStatus
source§fn cmp(&self, other: &UpdateActionStatus) -> Ordering
fn cmp(&self, other: &UpdateActionStatus) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<UpdateActionStatus> for UpdateActionStatus
impl PartialEq<UpdateActionStatus> for UpdateActionStatus
source§fn eq(&self, other: &UpdateActionStatus) -> bool
fn eq(&self, other: &UpdateActionStatus) -> bool
source§impl PartialOrd<UpdateActionStatus> for UpdateActionStatus
impl PartialOrd<UpdateActionStatus> for UpdateActionStatus
source§fn partial_cmp(&self, other: &UpdateActionStatus) -> Option<Ordering>
fn partial_cmp(&self, other: &UpdateActionStatus) -> 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 UpdateActionStatus
impl StructuralEq for UpdateActionStatus
impl StructuralPartialEq for UpdateActionStatus
Auto Trait Implementations§
impl RefUnwindSafe for UpdateActionStatus
impl Send for UpdateActionStatus
impl Sync for UpdateActionStatus
impl Unpin for UpdateActionStatus
impl UnwindSafe for UpdateActionStatus
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.