#[non_exhaustive]
pub enum TargetSelection {
    Continuous,
    Snapshot,
    Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against TargetSelection, 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 targetselection = unimplemented!();
match targetselection {
    TargetSelection::Continuous => { /* ... */ },
    TargetSelection::Snapshot => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

The above code demonstrates that when targetselection represents NewFeature, the execution path will lead to the second last match arm, even though the enum does not contain a variant TargetSelection::NewFeature in the current version of SDK. The reason is that the variable other, created by the @ operator, is bound to TargetSelection::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 TargetSelection::NewFeature is defined. Specifically, when targetselection represents NewFeature, the execution path will hit the second last match arm as before by virtue of calling as_str on TargetSelection::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.
§

Continuous

§

Snapshot

§

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 17393)
17392
17393
17394
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 495)
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
pub fn serialize_structure_crate_input_create_job_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateJobInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_98) = &input.abort_config {
        #[allow(unused_mut)]
        let mut object_99 = object.key("abortConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_abort_config(&mut object_99, var_98)?;
        object_99.finish();
    }
    if let Some(var_100) = &input.description {
        object.key("description").string(var_100.as_str());
    }
    if let Some(var_101) = &input.document {
        object.key("document").string(var_101.as_str());
    }
    if let Some(var_102) = &input.document_parameters {
        #[allow(unused_mut)]
        let mut object_103 = object.key("documentParameters").start_object();
        for (key_104, value_105) in var_102 {
            {
                object_103.key(key_104.as_str()).string(value_105.as_str());
            }
        }
        object_103.finish();
    }
    if let Some(var_106) = &input.document_source {
        object.key("documentSource").string(var_106.as_str());
    }
    if let Some(var_107) = &input.job_executions_retry_config {
        #[allow(unused_mut)]
        let mut object_108 = object.key("jobExecutionsRetryConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_job_executions_retry_config(
            &mut object_108,
            var_107,
        )?;
        object_108.finish();
    }
    if let Some(var_109) = &input.job_executions_rollout_config {
        #[allow(unused_mut)]
        let mut object_110 = object.key("jobExecutionsRolloutConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_job_executions_rollout_config(
            &mut object_110,
            var_109,
        )?;
        object_110.finish();
    }
    if let Some(var_111) = &input.job_template_arn {
        object.key("jobTemplateArn").string(var_111.as_str());
    }
    if let Some(var_112) = &input.namespace_id {
        object.key("namespaceId").string(var_112.as_str());
    }
    if let Some(var_113) = &input.presigned_url_config {
        #[allow(unused_mut)]
        let mut object_114 = object.key("presignedUrlConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_presigned_url_config(
            &mut object_114,
            var_113,
        )?;
        object_114.finish();
    }
    if let Some(var_115) = &input.tags {
        let mut array_116 = object.key("tags").start_array();
        for item_117 in var_115 {
            {
                #[allow(unused_mut)]
                let mut object_118 = array_116.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_118, item_117)?;
                object_118.finish();
            }
        }
        array_116.finish();
    }
    if let Some(var_119) = &input.target_selection {
        object.key("targetSelection").string(var_119.as_str());
    }
    if let Some(var_120) = &input.targets {
        let mut array_121 = object.key("targets").start_array();
        for item_122 in var_120 {
            {
                array_121.value().string(item_122.as_str());
            }
        }
        array_121.finish();
    }
    if let Some(var_123) = &input.timeout_config {
        #[allow(unused_mut)]
        let mut object_124 = object.key("timeoutConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_timeout_config(&mut object_124, var_123)?;
        object_124.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_job_template_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateJobTemplateInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_125) = &input.abort_config {
        #[allow(unused_mut)]
        let mut object_126 = object.key("abortConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_abort_config(&mut object_126, var_125)?;
        object_126.finish();
    }
    if let Some(var_127) = &input.description {
        object.key("description").string(var_127.as_str());
    }
    if let Some(var_128) = &input.document {
        object.key("document").string(var_128.as_str());
    }
    if let Some(var_129) = &input.document_source {
        object.key("documentSource").string(var_129.as_str());
    }
    if let Some(var_130) = &input.job_arn {
        object.key("jobArn").string(var_130.as_str());
    }
    if let Some(var_131) = &input.job_executions_retry_config {
        #[allow(unused_mut)]
        let mut object_132 = object.key("jobExecutionsRetryConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_job_executions_retry_config(
            &mut object_132,
            var_131,
        )?;
        object_132.finish();
    }
    if let Some(var_133) = &input.job_executions_rollout_config {
        #[allow(unused_mut)]
        let mut object_134 = object.key("jobExecutionsRolloutConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_job_executions_rollout_config(
            &mut object_134,
            var_133,
        )?;
        object_134.finish();
    }
    if let Some(var_135) = &input.presigned_url_config {
        #[allow(unused_mut)]
        let mut object_136 = object.key("presignedUrlConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_presigned_url_config(
            &mut object_136,
            var_135,
        )?;
        object_136.finish();
    }
    if let Some(var_137) = &input.tags {
        let mut array_138 = object.key("tags").start_array();
        for item_139 in var_137 {
            {
                #[allow(unused_mut)]
                let mut object_140 = array_138.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_140, item_139)?;
                object_140.finish();
            }
        }
        array_138.finish();
    }
    if let Some(var_141) = &input.timeout_config {
        #[allow(unused_mut)]
        let mut object_142 = object.key("timeoutConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_timeout_config(&mut object_142, var_141)?;
        object_142.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_mitigation_action_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateMitigationActionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_143) = &input.action_params {
        #[allow(unused_mut)]
        let mut object_144 = object.key("actionParams").start_object();
        crate::json_ser::serialize_structure_crate_model_mitigation_action_params(
            &mut object_144,
            var_143,
        )?;
        object_144.finish();
    }
    if let Some(var_145) = &input.role_arn {
        object.key("roleArn").string(var_145.as_str());
    }
    if let Some(var_146) = &input.tags {
        let mut array_147 = object.key("tags").start_array();
        for item_148 in var_146 {
            {
                #[allow(unused_mut)]
                let mut object_149 = array_147.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_149, item_148)?;
                object_149.finish();
            }
        }
        array_147.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_ota_update_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateOtaUpdateInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_150) = &input.additional_parameters {
        #[allow(unused_mut)]
        let mut object_151 = object.key("additionalParameters").start_object();
        for (key_152, value_153) in var_150 {
            {
                object_151.key(key_152.as_str()).string(value_153.as_str());
            }
        }
        object_151.finish();
    }
    if let Some(var_154) = &input.aws_job_abort_config {
        #[allow(unused_mut)]
        let mut object_155 = object.key("awsJobAbortConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_aws_job_abort_config(
            &mut object_155,
            var_154,
        )?;
        object_155.finish();
    }
    if let Some(var_156) = &input.aws_job_executions_rollout_config {
        #[allow(unused_mut)]
        let mut object_157 = object.key("awsJobExecutionsRolloutConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_aws_job_executions_rollout_config(
            &mut object_157,
            var_156,
        )?;
        object_157.finish();
    }
    if let Some(var_158) = &input.aws_job_presigned_url_config {
        #[allow(unused_mut)]
        let mut object_159 = object.key("awsJobPresignedUrlConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_aws_job_presigned_url_config(
            &mut object_159,
            var_158,
        )?;
        object_159.finish();
    }
    if let Some(var_160) = &input.aws_job_timeout_config {
        #[allow(unused_mut)]
        let mut object_161 = object.key("awsJobTimeoutConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_aws_job_timeout_config(
            &mut object_161,
            var_160,
        )?;
        object_161.finish();
    }
    if let Some(var_162) = &input.description {
        object.key("description").string(var_162.as_str());
    }
    if let Some(var_163) = &input.files {
        let mut array_164 = object.key("files").start_array();
        for item_165 in var_163 {
            {
                #[allow(unused_mut)]
                let mut object_166 = array_164.value().start_object();
                crate::json_ser::serialize_structure_crate_model_ota_update_file(
                    &mut object_166,
                    item_165,
                )?;
                object_166.finish();
            }
        }
        array_164.finish();
    }
    if let Some(var_167) = &input.protocols {
        let mut array_168 = object.key("protocols").start_array();
        for item_169 in var_167 {
            {
                array_168.value().string(item_169.as_str());
            }
        }
        array_168.finish();
    }
    if let Some(var_170) = &input.role_arn {
        object.key("roleArn").string(var_170.as_str());
    }
    if let Some(var_171) = &input.tags {
        let mut array_172 = object.key("tags").start_array();
        for item_173 in var_171 {
            {
                #[allow(unused_mut)]
                let mut object_174 = array_172.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_174, item_173)?;
                object_174.finish();
            }
        }
        array_172.finish();
    }
    if let Some(var_175) = &input.target_selection {
        object.key("targetSelection").string(var_175.as_str());
    }
    if let Some(var_176) = &input.targets {
        let mut array_177 = object.key("targets").start_array();
        for item_178 in var_176 {
            {
                array_177.value().string(item_178.as_str());
            }
        }
        array_177.finish();
    }
    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