#[non_exhaustive]
pub enum ParticipantRole {
    Agent,
    Customer,
    Unknown(UnknownVariantValue),
}
Expand description

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

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

Agent

§

Customer

§

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 828)
827
828
829
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 1051)
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
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
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(())
}

pub fn serialize_structure_crate_model_model_settings(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ModelSettings,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_227) = &input.language_model_name {
        object.key("LanguageModelName").string(var_227.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_job_execution_settings(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::JobExecutionSettings,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_228) = &input.allow_deferred_execution {
        object.key("AllowDeferredExecution").boolean(*var_228);
    }
    if let Some(var_229) = &input.data_access_role_arn {
        object.key("DataAccessRoleArn").string(var_229.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_content_redaction(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ContentRedaction,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_230) = &input.redaction_type {
        object.key("RedactionType").string(var_230.as_str());
    }
    if let Some(var_231) = &input.redaction_output {
        object.key("RedactionOutput").string(var_231.as_str());
    }
    if let Some(var_232) = &input.pii_entity_types {
        let mut array_233 = object.key("PiiEntityTypes").start_array();
        for item_234 in var_232 {
            {
                array_233.value().string(item_234.as_str());
            }
        }
        array_233.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_subtitles(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Subtitles,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_235) = &input.formats {
        let mut array_236 = object.key("Formats").start_array();
        for item_237 in var_235 {
            {
                array_236.value().string(item_237.as_str());
            }
        }
        array_236.finish();
    }
    if let Some(var_238) = &input.output_start_index {
        object.key("OutputStartIndex").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_238).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_language_id_settings(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::LanguageIdSettings,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_239) = &input.vocabulary_name {
        object.key("VocabularyName").string(var_239.as_str());
    }
    if let Some(var_240) = &input.vocabulary_filter_name {
        object.key("VocabularyFilterName").string(var_240.as_str());
    }
    if let Some(var_241) = &input.language_model_name {
        object.key("LanguageModelName").string(var_241.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_non_talk_time_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::NonTalkTimeFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_242) = &input.threshold {
        object.key("Threshold").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_242).into()),
        );
    }
    if let Some(var_243) = &input.absolute_time_range {
        #[allow(unused_mut)]
        let mut object_244 = object.key("AbsoluteTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_absolute_time_range(
            &mut object_244,
            var_243,
        )?;
        object_244.finish();
    }
    if let Some(var_245) = &input.relative_time_range {
        #[allow(unused_mut)]
        let mut object_246 = object.key("RelativeTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_relative_time_range(
            &mut object_246,
            var_245,
        )?;
        object_246.finish();
    }
    if let Some(var_247) = &input.negate {
        object.key("Negate").boolean(*var_247);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_interruption_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::InterruptionFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_248) = &input.threshold {
        object.key("Threshold").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_248).into()),
        );
    }
    if let Some(var_249) = &input.participant_role {
        object.key("ParticipantRole").string(var_249.as_str());
    }
    if let Some(var_250) = &input.absolute_time_range {
        #[allow(unused_mut)]
        let mut object_251 = object.key("AbsoluteTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_absolute_time_range(
            &mut object_251,
            var_250,
        )?;
        object_251.finish();
    }
    if let Some(var_252) = &input.relative_time_range {
        #[allow(unused_mut)]
        let mut object_253 = object.key("RelativeTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_relative_time_range(
            &mut object_253,
            var_252,
        )?;
        object_253.finish();
    }
    if let Some(var_254) = &input.negate {
        object.key("Negate").boolean(*var_254);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_transcript_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TranscriptFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_255) = &input.transcript_filter_type {
        object.key("TranscriptFilterType").string(var_255.as_str());
    }
    if let Some(var_256) = &input.absolute_time_range {
        #[allow(unused_mut)]
        let mut object_257 = object.key("AbsoluteTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_absolute_time_range(
            &mut object_257,
            var_256,
        )?;
        object_257.finish();
    }
    if let Some(var_258) = &input.relative_time_range {
        #[allow(unused_mut)]
        let mut object_259 = object.key("RelativeTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_relative_time_range(
            &mut object_259,
            var_258,
        )?;
        object_259.finish();
    }
    if let Some(var_260) = &input.participant_role {
        object.key("ParticipantRole").string(var_260.as_str());
    }
    if let Some(var_261) = &input.negate {
        object.key("Negate").boolean(*var_261);
    }
    if let Some(var_262) = &input.targets {
        let mut array_263 = object.key("Targets").start_array();
        for item_264 in var_262 {
            {
                array_263.value().string(item_264.as_str());
            }
        }
        array_263.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_sentiment_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::SentimentFilter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_265) = &input.sentiments {
        let mut array_266 = object.key("Sentiments").start_array();
        for item_267 in var_265 {
            {
                array_266.value().string(item_267.as_str());
            }
        }
        array_266.finish();
    }
    if let Some(var_268) = &input.absolute_time_range {
        #[allow(unused_mut)]
        let mut object_269 = object.key("AbsoluteTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_absolute_time_range(
            &mut object_269,
            var_268,
        )?;
        object_269.finish();
    }
    if let Some(var_270) = &input.relative_time_range {
        #[allow(unused_mut)]
        let mut object_271 = object.key("RelativeTimeRange").start_object();
        crate::json_ser::serialize_structure_crate_model_relative_time_range(
            &mut object_271,
            var_270,
        )?;
        object_271.finish();
    }
    if let Some(var_272) = &input.participant_role {
        object.key("ParticipantRole").string(var_272.as_str());
    }
    if let Some(var_273) = &input.negate {
        object.key("Negate").boolean(*var_273);
    }
    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