#[non_exhaustive]
pub enum MedicalContentIdentificationType {
Phi,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against MedicalContentIdentificationType, 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 medicalcontentidentificationtype = unimplemented!();
match medicalcontentidentificationtype {
MedicalContentIdentificationType::Phi => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when medicalcontentidentificationtype represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant MedicalContentIdentificationType::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
MedicalContentIdentificationType::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 MedicalContentIdentificationType::NewFeature is defined.
Specifically, when medicalcontentidentificationtype represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on MedicalContentIdentificationType::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
Phi
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl MedicalContentIdentificationType
impl MedicalContentIdentificationType
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 AsRef<str> for MedicalContentIdentificationType
impl AsRef<str> for MedicalContentIdentificationType
source§impl Clone for MedicalContentIdentificationType
impl Clone for MedicalContentIdentificationType
source§fn clone(&self) -> MedicalContentIdentificationType
fn clone(&self) -> MedicalContentIdentificationType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl From<&str> for MedicalContentIdentificationType
impl From<&str> for MedicalContentIdentificationType
source§impl Ord for MedicalContentIdentificationType
impl Ord for MedicalContentIdentificationType
source§fn cmp(&self, other: &MedicalContentIdentificationType) -> Ordering
fn cmp(&self, other: &MedicalContentIdentificationType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<MedicalContentIdentificationType> for MedicalContentIdentificationType
impl PartialEq<MedicalContentIdentificationType> for MedicalContentIdentificationType
source§fn eq(&self, other: &MedicalContentIdentificationType) -> bool
fn eq(&self, other: &MedicalContentIdentificationType) -> bool
source§impl PartialOrd<MedicalContentIdentificationType> for MedicalContentIdentificationType
impl PartialOrd<MedicalContentIdentificationType> for MedicalContentIdentificationType
source§fn partial_cmp(
&self,
other: &MedicalContentIdentificationType
) -> Option<Ordering>
fn partial_cmp(
&self,
other: &MedicalContentIdentificationType
) -> 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 MedicalContentIdentificationType
impl StructuralEq for MedicalContentIdentificationType
impl StructuralPartialEq for MedicalContentIdentificationType
Auto Trait Implementations§
impl RefUnwindSafe for MedicalContentIdentificationType
impl Send for MedicalContentIdentificationType
impl Sync for MedicalContentIdentificationType
impl Unpin for MedicalContentIdentificationType
impl UnwindSafe for MedicalContentIdentificationType
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.