Enum aws_sdk_devicefarm::model::BillingMethod
source · #[non_exhaustive]
pub enum BillingMethod {
Metered,
Unmetered,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against BillingMethod, 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 billingmethod = unimplemented!();
match billingmethod {
BillingMethod::Metered => { /* ... */ },
BillingMethod::Unmetered => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when billingmethod represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant BillingMethod::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
BillingMethod::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 BillingMethod::NewFeature is defined.
Specifically, when billingmethod represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on BillingMethod::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.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Metered
Unmetered
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl BillingMethod
impl BillingMethod
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
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 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547
pub fn serialize_structure_crate_model_create_remote_access_session_configuration(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateRemoteAccessSessionConfiguration,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_244) = &input.billing_method {
object.key("billingMethod").string(var_244.as_str());
}
if let Some(var_245) = &input.vpce_configuration_arns {
let mut array_246 = object.key("vpceConfigurationArns").start_array();
for item_247 in var_245 {
{
array_246.value().string(item_247.as_str());
}
}
array_246.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_test_grid_vpc_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::TestGridVpcConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_248) = &input.security_group_ids {
let mut array_249 = object.key("securityGroupIds").start_array();
for item_250 in var_248 {
{
array_249.value().string(item_250.as_str());
}
}
array_249.finish();
}
if let Some(var_251) = &input.subnet_ids {
let mut array_252 = object.key("subnetIds").start_array();
for item_253 in var_251 {
{
array_252.value().string(item_253.as_str());
}
}
array_252.finish();
}
if let Some(var_254) = &input.vpc_id {
object.key("vpcId").string(var_254.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_schedule_run_test(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ScheduleRunTest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_255) = &input.r#type {
object.key("type").string(var_255.as_str());
}
if let Some(var_256) = &input.test_package_arn {
object.key("testPackageArn").string(var_256.as_str());
}
if let Some(var_257) = &input.test_spec_arn {
object.key("testSpecArn").string(var_257.as_str());
}
if let Some(var_258) = &input.filter {
object.key("filter").string(var_258.as_str());
}
if let Some(var_259) = &input.parameters {
#[allow(unused_mut)]
let mut object_260 = object.key("parameters").start_object();
for (key_261, value_262) in var_259 {
{
object_260.key(key_261.as_str()).string(value_262.as_str());
}
}
object_260.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_schedule_run_configuration(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ScheduleRunConfiguration,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_263) = &input.extra_data_package_arn {
object.key("extraDataPackageArn").string(var_263.as_str());
}
if let Some(var_264) = &input.network_profile_arn {
object.key("networkProfileArn").string(var_264.as_str());
}
if let Some(var_265) = &input.locale {
object.key("locale").string(var_265.as_str());
}
if let Some(var_266) = &input.location {
#[allow(unused_mut)]
let mut object_267 = object.key("location").start_object();
crate::json_ser::serialize_structure_crate_model_location(&mut object_267, var_266)?;
object_267.finish();
}
if let Some(var_268) = &input.vpce_configuration_arns {
let mut array_269 = object.key("vpceConfigurationArns").start_array();
for item_270 in var_268 {
{
array_269.value().string(item_270.as_str());
}
}
array_269.finish();
}
if let Some(var_271) = &input.customer_artifact_paths {
#[allow(unused_mut)]
let mut object_272 = object.key("customerArtifactPaths").start_object();
crate::json_ser::serialize_structure_crate_model_customer_artifact_paths(
&mut object_272,
var_271,
)?;
object_272.finish();
}
if let Some(var_273) = &input.radios {
#[allow(unused_mut)]
let mut object_274 = object.key("radios").start_object();
crate::json_ser::serialize_structure_crate_model_radios(&mut object_274, var_273)?;
object_274.finish();
}
if let Some(var_275) = &input.auxiliary_apps {
let mut array_276 = object.key("auxiliaryApps").start_array();
for item_277 in var_275 {
{
array_276.value().string(item_277.as_str());
}
}
array_276.finish();
}
if let Some(var_278) = &input.billing_method {
object.key("billingMethod").string(var_278.as_str());
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for BillingMethod
impl AsRef<str> for BillingMethod
source§impl Clone for BillingMethod
impl Clone for BillingMethod
source§fn clone(&self) -> BillingMethod
fn clone(&self) -> BillingMethod
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for BillingMethod
impl Debug for BillingMethod
source§impl From<&str> for BillingMethod
impl From<&str> for BillingMethod
source§impl FromStr for BillingMethod
impl FromStr for BillingMethod
source§impl Hash for BillingMethod
impl Hash for BillingMethod
source§impl Ord for BillingMethod
impl Ord for BillingMethod
source§fn cmp(&self, other: &BillingMethod) -> Ordering
fn cmp(&self, other: &BillingMethod) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<BillingMethod> for BillingMethod
impl PartialEq<BillingMethod> for BillingMethod
source§fn eq(&self, other: &BillingMethod) -> bool
fn eq(&self, other: &BillingMethod) -> bool
source§impl PartialOrd<BillingMethod> for BillingMethod
impl PartialOrd<BillingMethod> for BillingMethod
source§fn partial_cmp(&self, other: &BillingMethod) -> Option<Ordering>
fn partial_cmp(&self, other: &BillingMethod) -> 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 BillingMethod
impl StructuralEq for BillingMethod
impl StructuralPartialEq for BillingMethod
Auto Trait Implementations§
impl RefUnwindSafe for BillingMethod
impl Send for BillingMethod
impl Sync for BillingMethod
impl Unpin for BillingMethod
impl UnwindSafe for BillingMethod
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.