#[non_exhaustive]
pub enum DeploymentUpdateType {
    CurrentVersion,
    MajorVersion,
    MinorVersion,
    None,
    Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against DeploymentUpdateType, 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 deploymentupdatetype = unimplemented!();
match deploymentupdatetype {
    DeploymentUpdateType::CurrentVersion => { /* ... */ },
    DeploymentUpdateType::MajorVersion => { /* ... */ },
    DeploymentUpdateType::MinorVersion => { /* ... */ },
    DeploymentUpdateType::None => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

The above code demonstrates that when deploymentupdatetype represents NewFeature, the execution path will lead to the second last match arm, even though the enum does not contain a variant DeploymentUpdateType::NewFeature in the current version of SDK. The reason is that the variable other, created by the @ operator, is bound to DeploymentUpdateType::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 DeploymentUpdateType::NewFeature is defined. Specifically, when deploymentupdatetype represents NewFeature, the execution path will hit the second last match arm as before by virtue of calling as_str on DeploymentUpdateType::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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

CurrentVersion

§

MajorVersion

§

MinorVersion

§

None

§

Unknown(UnknownVariantValue)

Unknown contains new variants that have been added since this code was generated.

Implementations§

Returns the &str value of the enum member.

Examples found in repository?
src/model.rs (line 3319)
3318
3319
3320
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 1267)
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
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
pub fn serialize_structure_crate_input_update_environment_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateEnvironmentInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_247) = &input.name {
        object.key("name").string(var_247.as_str());
    }
    if let Some(var_248) = &input.description {
        object.key("description").string(var_248.as_str());
    }
    if let Some(var_249) = &input.spec {
        object.key("spec").string(var_249.as_str());
    }
    if let Some(var_250) = &input.template_major_version {
        object.key("templateMajorVersion").string(var_250.as_str());
    }
    if let Some(var_251) = &input.template_minor_version {
        object.key("templateMinorVersion").string(var_251.as_str());
    }
    if let Some(var_252) = &input.proton_service_role_arn {
        object.key("protonServiceRoleArn").string(var_252.as_str());
    }
    if let Some(var_253) = &input.deployment_type {
        object.key("deploymentType").string(var_253.as_str());
    }
    if let Some(var_254) = &input.environment_account_connection_id {
        object
            .key("environmentAccountConnectionId")
            .string(var_254.as_str());
    }
    if let Some(var_255) = &input.provisioning_repository {
        #[allow(unused_mut)]
        let mut object_256 = object.key("provisioningRepository").start_object();
        crate::json_ser::serialize_structure_crate_model_repository_branch_input(
            &mut object_256,
            var_255,
        )?;
        object_256.finish();
    }
    if let Some(var_257) = &input.component_role_arn {
        object.key("componentRoleArn").string(var_257.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_environment_account_connection_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateEnvironmentAccountConnectionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_258) = &input.id {
        object.key("id").string(var_258.as_str());
    }
    if let Some(var_259) = &input.role_arn {
        object.key("roleArn").string(var_259.as_str());
    }
    if let Some(var_260) = &input.component_role_arn {
        object.key("componentRoleArn").string(var_260.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_environment_template_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateEnvironmentTemplateInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_261) = &input.name {
        object.key("name").string(var_261.as_str());
    }
    if let Some(var_262) = &input.display_name {
        object.key("displayName").string(var_262.as_str());
    }
    if let Some(var_263) = &input.description {
        object.key("description").string(var_263.as_str());
    }
    Ok(())
}

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(())
}

Returns all the &str values of the enum members.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more