#[non_exhaustive]
pub enum ResourceDeploymentStatus {
Failed,
InProgress,
Succeeded,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against ResourceDeploymentStatus, 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 resourcedeploymentstatus = unimplemented!();
match resourcedeploymentstatus {
ResourceDeploymentStatus::Failed => { /* ... */ },
ResourceDeploymentStatus::InProgress => { /* ... */ },
ResourceDeploymentStatus::Succeeded => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when resourcedeploymentstatus represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant ResourceDeploymentStatus::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
ResourceDeploymentStatus::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 ResourceDeploymentStatus::NewFeature is defined.
Specifically, when resourcedeploymentstatus represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on ResourceDeploymentStatus::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. The state that a PR-based deployment can be updated to.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Failed
InProgress
Succeeded
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl ResourceDeploymentStatus
impl ResourceDeploymentStatus
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
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
pub fn serialize_structure_crate_input_notify_resource_deployment_status_change_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::NotifyResourceDeploymentStatusChangeInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_218) = &input.resource_arn {
object.key("resourceArn").string(var_218.as_str());
}
if let Some(var_219) = &input.status {
object.key("status").string(var_219.as_str());
}
if let Some(var_220) = &input.outputs {
let mut array_221 = object.key("outputs").start_array();
for item_222 in var_220 {
{
#[allow(unused_mut)]
let mut object_223 = array_221.value().start_object();
crate::json_ser::serialize_structure_crate_model_output(&mut object_223, item_222)?;
object_223.finish();
}
}
array_221.finish();
}
if let Some(var_224) = &input.deployment_id {
object.key("deploymentId").string(var_224.as_str());
}
if let Some(var_225) = &input.status_message {
object.key("statusMessage").string(var_225.as_str());
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for ResourceDeploymentStatus
impl AsRef<str> for ResourceDeploymentStatus
source§impl Clone for ResourceDeploymentStatus
impl Clone for ResourceDeploymentStatus
source§fn clone(&self) -> ResourceDeploymentStatus
fn clone(&self) -> ResourceDeploymentStatus
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ResourceDeploymentStatus
impl Debug for ResourceDeploymentStatus
source§impl From<&str> for ResourceDeploymentStatus
impl From<&str> for ResourceDeploymentStatus
source§impl FromStr for ResourceDeploymentStatus
impl FromStr for ResourceDeploymentStatus
source§impl Hash for ResourceDeploymentStatus
impl Hash for ResourceDeploymentStatus
source§impl Ord for ResourceDeploymentStatus
impl Ord for ResourceDeploymentStatus
source§fn cmp(&self, other: &ResourceDeploymentStatus) -> Ordering
fn cmp(&self, other: &ResourceDeploymentStatus) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ResourceDeploymentStatus> for ResourceDeploymentStatus
impl PartialEq<ResourceDeploymentStatus> for ResourceDeploymentStatus
source§fn eq(&self, other: &ResourceDeploymentStatus) -> bool
fn eq(&self, other: &ResourceDeploymentStatus) -> bool
source§impl PartialOrd<ResourceDeploymentStatus> for ResourceDeploymentStatus
impl PartialOrd<ResourceDeploymentStatus> for ResourceDeploymentStatus
source§fn partial_cmp(&self, other: &ResourceDeploymentStatus) -> Option<Ordering>
fn partial_cmp(&self, other: &ResourceDeploymentStatus) -> 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 ResourceDeploymentStatus
impl StructuralEq for ResourceDeploymentStatus
impl StructuralPartialEq for ResourceDeploymentStatus
Auto Trait Implementations§
impl RefUnwindSafe for ResourceDeploymentStatus
impl Send for ResourceDeploymentStatus
impl Sync for ResourceDeploymentStatus
impl Unpin for ResourceDeploymentStatus
impl UnwindSafe for ResourceDeploymentStatus
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.