#[non_exhaustive]
pub enum VocabularyFilterMethod {
    Mask,
    Remove,
    Tag,
    Unknown(UnknownVariantValue),
}
Expand description

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

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

Mask

§

Remove

§

Tag

§

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 3753)
3752
3753
3754
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 998)
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
1120
1121
1122
1123
1124
pub fn serialize_structure_crate_model_call_analytics_job_settings(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::CallAnalyticsJobSettings,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_198) = &input.vocabulary_name {
        object.key("VocabularyName").string(var_198.as_str());
    }
    if let Some(var_199) = &input.vocabulary_filter_name {
        object.key("VocabularyFilterName").string(var_199.as_str());
    }
    if let Some(var_200) = &input.vocabulary_filter_method {
        object
            .key("VocabularyFilterMethod")
            .string(var_200.as_str());
    }
    if let Some(var_201) = &input.language_model_name {
        object.key("LanguageModelName").string(var_201.as_str());
    }
    if let Some(var_202) = &input.content_redaction {
        #[allow(unused_mut)]
        let mut object_203 = object.key("ContentRedaction").start_object();
        crate::json_ser::serialize_structure_crate_model_content_redaction(
            &mut object_203,
            var_202,
        )?;
        object_203.finish();
    }
    if let Some(var_204) = &input.language_options {
        let mut array_205 = object.key("LanguageOptions").start_array();
        for item_206 in var_204 {
            {
                array_205.value().string(item_206.as_str());
            }
        }
        array_205.finish();
    }
    if let Some(var_207) = &input.language_id_settings {
        #[allow(unused_mut)]
        let mut object_208 = object.key("LanguageIdSettings").start_object();
        for (key_209, value_210) in var_207 {
            {
                #[allow(unused_mut)]
                let mut object_211 = object_208.key(key_209.as_str()).start_object();
                crate::json_ser::serialize_structure_crate_model_language_id_settings(
                    &mut object_211,
                    value_210,
                )?;
                object_211.finish();
            }
        }
        object_208.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_channel_definition(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ChannelDefinition,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if input.channel_id != 0 {
        object.key("ChannelId").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.channel_id).into()),
        );
    }
    if let Some(var_212) = &input.participant_role {
        object.key("ParticipantRole").string(var_212.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_medical_transcription_setting(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::MedicalTranscriptionSetting,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_213) = &input.show_speaker_labels {
        object.key("ShowSpeakerLabels").boolean(*var_213);
    }
    if let Some(var_214) = &input.max_speaker_labels {
        object.key("MaxSpeakerLabels").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_214).into()),
        );
    }
    if let Some(var_215) = &input.channel_identification {
        object.key("ChannelIdentification").boolean(*var_215);
    }
    if let Some(var_216) = &input.show_alternatives {
        object.key("ShowAlternatives").boolean(*var_216);
    }
    if let Some(var_217) = &input.max_alternatives {
        object.key("MaxAlternatives").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_217).into()),
        );
    }
    if let Some(var_218) = &input.vocabulary_name {
        object.key("VocabularyName").string(var_218.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_settings(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Settings,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_219) = &input.vocabulary_name {
        object.key("VocabularyName").string(var_219.as_str());
    }
    if let Some(var_220) = &input.show_speaker_labels {
        object.key("ShowSpeakerLabels").boolean(*var_220);
    }
    if let Some(var_221) = &input.max_speaker_labels {
        object.key("MaxSpeakerLabels").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_221).into()),
        );
    }
    if let Some(var_222) = &input.channel_identification {
        object.key("ChannelIdentification").boolean(*var_222);
    }
    if let Some(var_223) = &input.show_alternatives {
        object.key("ShowAlternatives").boolean(*var_223);
    }
    if let Some(var_224) = &input.max_alternatives {
        object.key("MaxAlternatives").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_224).into()),
        );
    }
    if let Some(var_225) = &input.vocabulary_filter_name {
        object.key("VocabularyFilterName").string(var_225.as_str());
    }
    if let Some(var_226) = &input.vocabulary_filter_method {
        object
            .key("VocabularyFilterMethod")
            .string(var_226.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