#[non_exhaustive]
pub enum PriceClass {
    PriceClass100,
    PriceClass200,
    PriceClassAll,
    Unknown(UnknownVariantValue),
}
Expand description

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

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

PriceClass100

§

PriceClass200

§

PriceClassAll

§

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 483)
482
483
484
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/xml_ser.rs (line 740)
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
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
pub fn serialize_structure_crate_model_distribution_config(
    input: &crate::model::DistributionConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_37) = &input.caller_reference {
        let mut inner_writer = scope.start_el("CallerReference").finish();
        inner_writer.data(var_37.as_str());
    }
    if let Some(var_38) = &input.aliases {
        let inner_writer = scope.start_el("Aliases");
        crate::xml_ser::serialize_structure_crate_model_aliases(var_38, inner_writer)?
    }
    if let Some(var_39) = &input.default_root_object {
        let mut inner_writer = scope.start_el("DefaultRootObject").finish();
        inner_writer.data(var_39.as_str());
    }
    if let Some(var_40) = &input.origins {
        let inner_writer = scope.start_el("Origins");
        crate::xml_ser::serialize_structure_crate_model_origins(var_40, inner_writer)?
    }
    if let Some(var_41) = &input.origin_groups {
        let inner_writer = scope.start_el("OriginGroups");
        crate::xml_ser::serialize_structure_crate_model_origin_groups(var_41, inner_writer)?
    }
    if let Some(var_42) = &input.default_cache_behavior {
        let inner_writer = scope.start_el("DefaultCacheBehavior");
        crate::xml_ser::serialize_structure_crate_model_default_cache_behavior(
            var_42,
            inner_writer,
        )?
    }
    if let Some(var_43) = &input.cache_behaviors {
        let inner_writer = scope.start_el("CacheBehaviors");
        crate::xml_ser::serialize_structure_crate_model_cache_behaviors(var_43, inner_writer)?
    }
    if let Some(var_44) = &input.custom_error_responses {
        let inner_writer = scope.start_el("CustomErrorResponses");
        crate::xml_ser::serialize_structure_crate_model_custom_error_responses(
            var_44,
            inner_writer,
        )?
    }
    if let Some(var_45) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_45.as_str());
    }
    if let Some(var_46) = &input.logging {
        let inner_writer = scope.start_el("Logging");
        crate::xml_ser::serialize_structure_crate_model_logging_config(var_46, inner_writer)?
    }
    if let Some(var_47) = &input.price_class {
        let mut inner_writer = scope.start_el("PriceClass").finish();
        inner_writer.data(var_47.as_str());
    }
    if let Some(var_48) = &input.enabled {
        let mut inner_writer = scope.start_el("Enabled").finish();
        inner_writer.data(aws_smithy_types::primitive::Encoder::from(*var_48).encode());
    }
    if let Some(var_49) = &input.viewer_certificate {
        let inner_writer = scope.start_el("ViewerCertificate");
        crate::xml_ser::serialize_structure_crate_model_viewer_certificate(var_49, inner_writer)?
    }
    if let Some(var_50) = &input.restrictions {
        let inner_writer = scope.start_el("Restrictions");
        crate::xml_ser::serialize_structure_crate_model_restrictions(var_50, inner_writer)?
    }
    if let Some(var_51) = &input.web_acl_id {
        let mut inner_writer = scope.start_el("WebACLId").finish();
        inner_writer.data(var_51.as_str());
    }
    if let Some(var_52) = &input.http_version {
        let mut inner_writer = scope.start_el("HttpVersion").finish();
        inner_writer.data(var_52.as_str());
    }
    if let Some(var_53) = &input.is_ipv6_enabled {
        let mut inner_writer = scope.start_el("IsIPV6Enabled").finish();
        inner_writer.data(aws_smithy_types::primitive::Encoder::from(*var_53).encode());
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_distribution_config_with_tags(
    input: &crate::model::DistributionConfigWithTags,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_54) = &input.distribution_config {
        let inner_writer = scope.start_el("DistributionConfig");
        crate::xml_ser::serialize_structure_crate_model_distribution_config(var_54, inner_writer)?
    }
    if let Some(var_55) = &input.tags {
        let inner_writer = scope.start_el("Tags");
        crate::xml_ser::serialize_structure_crate_model_tags(var_55, inner_writer)?
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_field_level_encryption_config(
    input: &crate::model::FieldLevelEncryptionConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_56) = &input.caller_reference {
        let mut inner_writer = scope.start_el("CallerReference").finish();
        inner_writer.data(var_56.as_str());
    }
    if let Some(var_57) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_57.as_str());
    }
    if let Some(var_58) = &input.query_arg_profile_config {
        let inner_writer = scope.start_el("QueryArgProfileConfig");
        crate::xml_ser::serialize_structure_crate_model_query_arg_profile_config(
            var_58,
            inner_writer,
        )?
    }
    if let Some(var_59) = &input.content_type_profile_config {
        let inner_writer = scope.start_el("ContentTypeProfileConfig");
        crate::xml_ser::serialize_structure_crate_model_content_type_profile_config(
            var_59,
            inner_writer,
        )?
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_field_level_encryption_profile_config(
    input: &crate::model::FieldLevelEncryptionProfileConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_60) = &input.name {
        let mut inner_writer = scope.start_el("Name").finish();
        inner_writer.data(var_60.as_str());
    }
    if let Some(var_61) = &input.caller_reference {
        let mut inner_writer = scope.start_el("CallerReference").finish();
        inner_writer.data(var_61.as_str());
    }
    if let Some(var_62) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_62.as_str());
    }
    if let Some(var_63) = &input.encryption_entities {
        let inner_writer = scope.start_el("EncryptionEntities");
        crate::xml_ser::serialize_structure_crate_model_encryption_entities(var_63, inner_writer)?
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_function_config(
    input: &crate::model::FunctionConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_64) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_64.as_str());
    }
    if let Some(var_65) = &input.runtime {
        let mut inner_writer = scope.start_el("Runtime").finish();
        inner_writer.data(var_65.as_str());
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_invalidation_batch(
    input: &crate::model::InvalidationBatch,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_66) = &input.paths {
        let inner_writer = scope.start_el("Paths");
        crate::xml_ser::serialize_structure_crate_model_paths(var_66, inner_writer)?
    }
    if let Some(var_67) = &input.caller_reference {
        let mut inner_writer = scope.start_el("CallerReference").finish();
        inner_writer.data(var_67.as_str());
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_key_group_config(
    input: &crate::model::KeyGroupConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_68) = &input.name {
        let mut inner_writer = scope.start_el("Name").finish();
        inner_writer.data(var_68.as_str());
    }
    if let Some(var_69) = &input.items {
        let mut inner_writer = scope.start_el("Items").finish();
        for list_item_70 in var_69 {
            {
                let mut inner_writer = inner_writer.start_el("PublicKey").finish();
                inner_writer.data(list_item_70.as_str());
            }
        }
    }
    if let Some(var_71) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_71.as_str());
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_monitoring_subscription(
    input: &crate::model::MonitoringSubscription,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_72) = &input.realtime_metrics_subscription_config {
        let inner_writer = scope.start_el("RealtimeMetricsSubscriptionConfig");
        crate::xml_ser::serialize_structure_crate_model_realtime_metrics_subscription_config(
            var_72,
            inner_writer,
        )?
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_origin_access_control_config(
    input: &crate::model::OriginAccessControlConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_73) = &input.name {
        let mut inner_writer = scope.start_el("Name").finish();
        inner_writer.data(var_73.as_str());
    }
    if let Some(var_74) = &input.description {
        let mut inner_writer = scope.start_el("Description").finish();
        inner_writer.data(var_74.as_str());
    }
    if let Some(var_75) = &input.signing_protocol {
        let mut inner_writer = scope.start_el("SigningProtocol").finish();
        inner_writer.data(var_75.as_str());
    }
    if let Some(var_76) = &input.signing_behavior {
        let mut inner_writer = scope.start_el("SigningBehavior").finish();
        inner_writer.data(var_76.as_str());
    }
    if let Some(var_77) = &input.origin_access_control_origin_type {
        let mut inner_writer = scope.start_el("OriginAccessControlOriginType").finish();
        inner_writer.data(var_77.as_str());
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_origin_request_policy_config(
    input: &crate::model::OriginRequestPolicyConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_78) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_78.as_str());
    }
    if let Some(var_79) = &input.name {
        let mut inner_writer = scope.start_el("Name").finish();
        inner_writer.data(var_79.as_str());
    }
    if let Some(var_80) = &input.headers_config {
        let inner_writer = scope.start_el("HeadersConfig");
        crate::xml_ser::serialize_structure_crate_model_origin_request_policy_headers_config(
            var_80,
            inner_writer,
        )?
    }
    if let Some(var_81) = &input.cookies_config {
        let inner_writer = scope.start_el("CookiesConfig");
        crate::xml_ser::serialize_structure_crate_model_origin_request_policy_cookies_config(
            var_81,
            inner_writer,
        )?
    }
    if let Some(var_82) = &input.query_strings_config {
        let inner_writer = scope.start_el("QueryStringsConfig");
        crate::xml_ser::serialize_structure_crate_model_origin_request_policy_query_strings_config(
            var_82,
            inner_writer,
        )?
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_public_key_config(
    input: &crate::model::PublicKeyConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_83) = &input.caller_reference {
        let mut inner_writer = scope.start_el("CallerReference").finish();
        inner_writer.data(var_83.as_str());
    }
    if let Some(var_84) = &input.name {
        let mut inner_writer = scope.start_el("Name").finish();
        inner_writer.data(var_84.as_str());
    }
    if let Some(var_85) = &input.encoded_key {
        let mut inner_writer = scope.start_el("EncodedKey").finish();
        inner_writer.data(var_85.as_str());
    }
    if let Some(var_86) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_86.as_str());
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_end_point(
    input: &crate::model::EndPoint,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_87) = &input.stream_type {
        let mut inner_writer = scope.start_el("StreamType").finish();
        inner_writer.data(var_87.as_str());
    }
    if let Some(var_88) = &input.kinesis_stream_config {
        let inner_writer = scope.start_el("KinesisStreamConfig");
        crate::xml_ser::serialize_structure_crate_model_kinesis_stream_config(var_88, inner_writer)?
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_response_headers_policy_config(
    input: &crate::model::ResponseHeadersPolicyConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_89) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_89.as_str());
    }
    if let Some(var_90) = &input.name {
        let mut inner_writer = scope.start_el("Name").finish();
        inner_writer.data(var_90.as_str());
    }
    if let Some(var_91) = &input.cors_config {
        let inner_writer = scope.start_el("CorsConfig");
        crate::xml_ser::serialize_structure_crate_model_response_headers_policy_cors_config(
            var_91,
            inner_writer,
        )?
    }
    if let Some(var_92) = &input.security_headers_config {
        let inner_writer = scope.start_el("SecurityHeadersConfig");
        crate::xml_ser::serialize_structure_crate_model_response_headers_policy_security_headers_config(var_92, inner_writer)?
    }
    if let Some(var_93) = &input.server_timing_headers_config {
        let inner_writer = scope.start_el("ServerTimingHeadersConfig");
        crate::xml_ser::serialize_structure_crate_model_response_headers_policy_server_timing_headers_config(var_93, inner_writer)?
    }
    if let Some(var_94) = &input.custom_headers_config {
        let inner_writer = scope.start_el("CustomHeadersConfig");
        crate::xml_ser::serialize_structure_crate_model_response_headers_policy_custom_headers_config(var_94, inner_writer)?
    }
    scope.finish();
    Ok(())
}

pub fn serialize_structure_crate_model_streaming_distribution_config(
    input: &crate::model::StreamingDistributionConfig,
    writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_95) = &input.caller_reference {
        let mut inner_writer = scope.start_el("CallerReference").finish();
        inner_writer.data(var_95.as_str());
    }
    if let Some(var_96) = &input.s3_origin {
        let inner_writer = scope.start_el("S3Origin");
        crate::xml_ser::serialize_structure_crate_model_s3_origin(var_96, inner_writer)?
    }
    if let Some(var_97) = &input.aliases {
        let inner_writer = scope.start_el("Aliases");
        crate::xml_ser::serialize_structure_crate_model_aliases(var_97, inner_writer)?
    }
    if let Some(var_98) = &input.comment {
        let mut inner_writer = scope.start_el("Comment").finish();
        inner_writer.data(var_98.as_str());
    }
    if let Some(var_99) = &input.logging {
        let inner_writer = scope.start_el("Logging");
        crate::xml_ser::serialize_structure_crate_model_streaming_logging_config(
            var_99,
            inner_writer,
        )?
    }
    if let Some(var_100) = &input.trusted_signers {
        let inner_writer = scope.start_el("TrustedSigners");
        crate::xml_ser::serialize_structure_crate_model_trusted_signers(var_100, inner_writer)?
    }
    if let Some(var_101) = &input.price_class {
        let mut inner_writer = scope.start_el("PriceClass").finish();
        inner_writer.data(var_101.as_str());
    }
    if let Some(var_102) = &input.enabled {
        let mut inner_writer = scope.start_el("Enabled").finish();
        inner_writer.data(aws_smithy_types::primitive::Encoder::from(*var_102).encode());
    }
    scope.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