#[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
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
Mask
Remove
Tag
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl VocabularyFilterMethod
impl VocabularyFilterMethod
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
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(())
}Trait Implementations§
source§impl AsRef<str> for VocabularyFilterMethod
impl AsRef<str> for VocabularyFilterMethod
source§impl Clone for VocabularyFilterMethod
impl Clone for VocabularyFilterMethod
source§fn clone(&self) -> VocabularyFilterMethod
fn clone(&self) -> VocabularyFilterMethod
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for VocabularyFilterMethod
impl Debug for VocabularyFilterMethod
source§impl From<&str> for VocabularyFilterMethod
impl From<&str> for VocabularyFilterMethod
source§impl FromStr for VocabularyFilterMethod
impl FromStr for VocabularyFilterMethod
source§impl Hash for VocabularyFilterMethod
impl Hash for VocabularyFilterMethod
source§impl Ord for VocabularyFilterMethod
impl Ord for VocabularyFilterMethod
source§fn cmp(&self, other: &VocabularyFilterMethod) -> Ordering
fn cmp(&self, other: &VocabularyFilterMethod) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<VocabularyFilterMethod> for VocabularyFilterMethod
impl PartialEq<VocabularyFilterMethod> for VocabularyFilterMethod
source§fn eq(&self, other: &VocabularyFilterMethod) -> bool
fn eq(&self, other: &VocabularyFilterMethod) -> bool
source§impl PartialOrd<VocabularyFilterMethod> for VocabularyFilterMethod
impl PartialOrd<VocabularyFilterMethod> for VocabularyFilterMethod
source§fn partial_cmp(&self, other: &VocabularyFilterMethod) -> Option<Ordering>
fn partial_cmp(&self, other: &VocabularyFilterMethod) -> 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 VocabularyFilterMethod
impl StructuralEq for VocabularyFilterMethod
impl StructuralPartialEq for VocabularyFilterMethod
Auto Trait Implementations§
impl RefUnwindSafe for VocabularyFilterMethod
impl Send for VocabularyFilterMethod
impl Sync for VocabularyFilterMethod
impl Unpin for VocabularyFilterMethod
impl UnwindSafe for VocabularyFilterMethod
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.