Enum aws_sdk_transcribe::model::Specialty
source · #[non_exhaustive]
pub enum Specialty {
Primarycare,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against Specialty, 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 specialty = unimplemented!();
match specialty {
Specialty::Primarycare => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when specialty represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant Specialty::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
Specialty::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 Specialty::NewFeature is defined.
Specifically, when specialty represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on Specialty::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
Primarycare
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl Specialty
impl Specialty
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
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
pub fn serialize_structure_crate_input_start_medical_transcription_job_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::StartMedicalTranscriptionJobInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_100) = &input.medical_transcription_job_name {
object
.key("MedicalTranscriptionJobName")
.string(var_100.as_str());
}
if let Some(var_101) = &input.language_code {
object.key("LanguageCode").string(var_101.as_str());
}
if let Some(var_102) = &input.media_sample_rate_hertz {
object.key("MediaSampleRateHertz").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_102).into()),
);
}
if let Some(var_103) = &input.media_format {
object.key("MediaFormat").string(var_103.as_str());
}
if let Some(var_104) = &input.media {
#[allow(unused_mut)]
let mut object_105 = object.key("Media").start_object();
crate::json_ser::serialize_structure_crate_model_media(&mut object_105, var_104)?;
object_105.finish();
}
if let Some(var_106) = &input.output_bucket_name {
object.key("OutputBucketName").string(var_106.as_str());
}
if let Some(var_107) = &input.output_key {
object.key("OutputKey").string(var_107.as_str());
}
if let Some(var_108) = &input.output_encryption_kms_key_id {
object
.key("OutputEncryptionKMSKeyId")
.string(var_108.as_str());
}
if let Some(var_109) = &input.kms_encryption_context {
#[allow(unused_mut)]
let mut object_110 = object.key("KMSEncryptionContext").start_object();
for (key_111, value_112) in var_109 {
{
object_110.key(key_111.as_str()).string(value_112.as_str());
}
}
object_110.finish();
}
if let Some(var_113) = &input.settings {
#[allow(unused_mut)]
let mut object_114 = object.key("Settings").start_object();
crate::json_ser::serialize_structure_crate_model_medical_transcription_setting(
&mut object_114,
var_113,
)?;
object_114.finish();
}
if let Some(var_115) = &input.content_identification_type {
object
.key("ContentIdentificationType")
.string(var_115.as_str());
}
if let Some(var_116) = &input.specialty {
object.key("Specialty").string(var_116.as_str());
}
if let Some(var_117) = &input.r#type {
object.key("Type").string(var_117.as_str());
}
if let Some(var_118) = &input.tags {
let mut array_119 = object.key("Tags").start_array();
for item_120 in var_118 {
{
#[allow(unused_mut)]
let mut object_121 = array_119.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_121, item_120)?;
object_121.finish();
}
}
array_119.finish();
}
Ok(())
}Trait Implementations§
source§impl Ord for Specialty
impl Ord for Specialty
source§impl PartialOrd<Specialty> for Specialty
impl PartialOrd<Specialty> for Specialty
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 Specialty
impl StructuralEq for Specialty
impl StructuralPartialEq for Specialty
Auto Trait Implementations§
impl RefUnwindSafe for Specialty
impl Send for Specialty
impl Sync for Specialty
impl Unpin for Specialty
impl UnwindSafe for Specialty
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.