#[non_exhaustive]
pub enum TemplateVersionStatus {
Draft,
Published,
RegistrationFailed,
RegistrationInProgress,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against TemplateVersionStatus
, 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 templateversionstatus = unimplemented!();
match templateversionstatus {
TemplateVersionStatus::Draft => { /* ... */ },
TemplateVersionStatus::Published => { /* ... */ },
TemplateVersionStatus::RegistrationFailed => { /* ... */ },
TemplateVersionStatus::RegistrationInProgress => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when templateversionstatus
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant TemplateVersionStatus::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
TemplateVersionStatus::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 TemplateVersionStatus::NewFeature
is defined.
Specifically, when templateversionstatus
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on TemplateVersionStatus::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
Draft
Published
RegistrationFailed
RegistrationInProgress
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl TemplateVersionStatus
impl TemplateVersionStatus
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
1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 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 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463
pub fn serialize_structure_crate_input_update_environment_template_version_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateEnvironmentTemplateVersionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_264) = &input.template_name {
object.key("templateName").string(var_264.as_str());
}
if let Some(var_265) = &input.major_version {
object.key("majorVersion").string(var_265.as_str());
}
if let Some(var_266) = &input.minor_version {
object.key("minorVersion").string(var_266.as_str());
}
if let Some(var_267) = &input.description {
object.key("description").string(var_267.as_str());
}
if let Some(var_268) = &input.status {
object.key("status").string(var_268.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_service_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateServiceInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_269) = &input.name {
object.key("name").string(var_269.as_str());
}
if let Some(var_270) = &input.description {
object.key("description").string(var_270.as_str());
}
if let Some(var_271) = &input.spec {
object.key("spec").string(var_271.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_service_instance_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateServiceInstanceInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_272) = &input.name {
object.key("name").string(var_272.as_str());
}
if let Some(var_273) = &input.service_name {
object.key("serviceName").string(var_273.as_str());
}
if let Some(var_274) = &input.deployment_type {
object.key("deploymentType").string(var_274.as_str());
}
if let Some(var_275) = &input.spec {
object.key("spec").string(var_275.as_str());
}
if let Some(var_276) = &input.template_major_version {
object.key("templateMajorVersion").string(var_276.as_str());
}
if let Some(var_277) = &input.template_minor_version {
object.key("templateMinorVersion").string(var_277.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_service_pipeline_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateServicePipelineInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_278) = &input.service_name {
object.key("serviceName").string(var_278.as_str());
}
if let Some(var_279) = &input.spec {
object.key("spec").string(var_279.as_str());
}
if let Some(var_280) = &input.deployment_type {
object.key("deploymentType").string(var_280.as_str());
}
if let Some(var_281) = &input.template_major_version {
object.key("templateMajorVersion").string(var_281.as_str());
}
if let Some(var_282) = &input.template_minor_version {
object.key("templateMinorVersion").string(var_282.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_service_template_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateServiceTemplateInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_283) = &input.name {
object.key("name").string(var_283.as_str());
}
if let Some(var_284) = &input.display_name {
object.key("displayName").string(var_284.as_str());
}
if let Some(var_285) = &input.description {
object.key("description").string(var_285.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_service_template_version_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateServiceTemplateVersionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_286) = &input.template_name {
object.key("templateName").string(var_286.as_str());
}
if let Some(var_287) = &input.major_version {
object.key("majorVersion").string(var_287.as_str());
}
if let Some(var_288) = &input.minor_version {
object.key("minorVersion").string(var_288.as_str());
}
if let Some(var_289) = &input.description {
object.key("description").string(var_289.as_str());
}
if let Some(var_290) = &input.status {
object.key("status").string(var_290.as_str());
}
if let Some(var_291) = &input.compatible_environment_templates {
let mut array_292 = object.key("compatibleEnvironmentTemplates").start_array();
for item_293 in var_291 {
{
#[allow(unused_mut)]
let mut object_294 = array_292.value().start_object();
crate::json_ser::serialize_structure_crate_model_compatible_environment_template_input(&mut object_294, item_293)?;
object_294.finish();
}
}
array_292.finish();
}
if let Some(var_295) = &input.supported_component_sources {
let mut array_296 = object.key("supportedComponentSources").start_array();
for item_297 in var_295 {
{
array_296.value().string(item_297.as_str());
}
}
array_296.finish();
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for TemplateVersionStatus
impl AsRef<str> for TemplateVersionStatus
source§impl Clone for TemplateVersionStatus
impl Clone for TemplateVersionStatus
source§fn clone(&self) -> TemplateVersionStatus
fn clone(&self) -> TemplateVersionStatus
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TemplateVersionStatus
impl Debug for TemplateVersionStatus
source§impl From<&str> for TemplateVersionStatus
impl From<&str> for TemplateVersionStatus
source§impl FromStr for TemplateVersionStatus
impl FromStr for TemplateVersionStatus
source§impl Hash for TemplateVersionStatus
impl Hash for TemplateVersionStatus
source§impl Ord for TemplateVersionStatus
impl Ord for TemplateVersionStatus
source§fn cmp(&self, other: &TemplateVersionStatus) -> Ordering
fn cmp(&self, other: &TemplateVersionStatus) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<TemplateVersionStatus> for TemplateVersionStatus
impl PartialEq<TemplateVersionStatus> for TemplateVersionStatus
source§fn eq(&self, other: &TemplateVersionStatus) -> bool
fn eq(&self, other: &TemplateVersionStatus) -> bool
source§impl PartialOrd<TemplateVersionStatus> for TemplateVersionStatus
impl PartialOrd<TemplateVersionStatus> for TemplateVersionStatus
source§fn partial_cmp(&self, other: &TemplateVersionStatus) -> Option<Ordering>
fn partial_cmp(&self, other: &TemplateVersionStatus) -> 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 TemplateVersionStatus
impl StructuralEq for TemplateVersionStatus
impl StructuralPartialEq for TemplateVersionStatus
Auto Trait Implementations§
impl RefUnwindSafe for TemplateVersionStatus
impl Send for TemplateVersionStatus
impl Sync for TemplateVersionStatus
impl Unpin for TemplateVersionStatus
impl UnwindSafe for TemplateVersionStatus
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.