Enum aws_sdk_devicefarm::model::RuleOperator
source · #[non_exhaustive]
pub enum RuleOperator {
Contains,
Equals,
GreaterThan,
GreaterThanOrEquals,
In,
LessThan,
LessThanOrEquals,
NotIn,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against RuleOperator, 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 ruleoperator = unimplemented!();
match ruleoperator {
RuleOperator::Contains => { /* ... */ },
RuleOperator::Equals => { /* ... */ },
RuleOperator::GreaterThan => { /* ... */ },
RuleOperator::GreaterThanOrEquals => { /* ... */ },
RuleOperator::In => { /* ... */ },
RuleOperator::LessThan => { /* ... */ },
RuleOperator::LessThanOrEquals => { /* ... */ },
RuleOperator::NotIn => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when ruleoperator represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant RuleOperator::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
RuleOperator::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 RuleOperator::NewFeature is defined.
Specifically, when ruleoperator represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on RuleOperator::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
Contains
Equals
GreaterThan
GreaterThanOrEquals
In
LessThan
LessThanOrEquals
NotIn
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl RuleOperator
impl RuleOperator
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
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 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 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569
pub fn serialize_structure_crate_model_rule(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::Rule,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_234) = &input.attribute {
object.key("attribute").string(var_234.as_str());
}
if let Some(var_235) = &input.operator {
object.key("operator").string(var_235.as_str());
}
if let Some(var_236) = &input.value {
object.key("value").string(var_236.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_vpc_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::VpcConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_237) = &input.security_group_ids {
let mut array_238 = object.key("securityGroupIds").start_array();
for item_239 in var_237 {
{
array_238.value().string(item_239.as_str());
}
}
array_238.finish();
}
if let Some(var_240) = &input.subnet_ids {
let mut array_241 = object.key("subnetIds").start_array();
for item_242 in var_240 {
{
array_241.value().string(item_242.as_str());
}
}
array_241.finish();
}
if let Some(var_243) = &input.vpc_id {
object.key("vpcId").string(var_243.as_str());
}
Ok(())
}
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(())
}
pub fn serialize_structure_crate_model_device_filter(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::DeviceFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_279) = &input.attribute {
object.key("attribute").string(var_279.as_str());
}
if let Some(var_280) = &input.operator {
object.key("operator").string(var_280.as_str());
}
if let Some(var_281) = &input.values {
let mut array_282 = object.key("values").start_array();
for item_283 in var_281 {
{
array_282.value().string(item_283.as_str());
}
}
array_282.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for RuleOperator
impl AsRef<str> for RuleOperator
source§impl Clone for RuleOperator
impl Clone for RuleOperator
source§fn clone(&self) -> RuleOperator
fn clone(&self) -> RuleOperator
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for RuleOperator
impl Debug for RuleOperator
source§impl From<&str> for RuleOperator
impl From<&str> for RuleOperator
source§impl FromStr for RuleOperator
impl FromStr for RuleOperator
source§impl Hash for RuleOperator
impl Hash for RuleOperator
source§impl Ord for RuleOperator
impl Ord for RuleOperator
source§fn cmp(&self, other: &RuleOperator) -> Ordering
fn cmp(&self, other: &RuleOperator) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<RuleOperator> for RuleOperator
impl PartialEq<RuleOperator> for RuleOperator
source§fn eq(&self, other: &RuleOperator) -> bool
fn eq(&self, other: &RuleOperator) -> bool
source§impl PartialOrd<RuleOperator> for RuleOperator
impl PartialOrd<RuleOperator> for RuleOperator
source§fn partial_cmp(&self, other: &RuleOperator) -> Option<Ordering>
fn partial_cmp(&self, other: &RuleOperator) -> 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 RuleOperator
impl StructuralEq for RuleOperator
impl StructuralPartialEq for RuleOperator
Auto Trait Implementations§
impl RefUnwindSafe for RuleOperator
impl Send for RuleOperator
impl Sync for RuleOperator
impl Unpin for RuleOperator
impl UnwindSafe for RuleOperator
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.