Enum aws_sdk_transcribe::model::MediaFormat
source · #[non_exhaustive]
pub enum MediaFormat {
Amr,
Flac,
Mp3,
Mp4,
Ogg,
Wav,
Webm,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against MediaFormat, 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 mediaformat = unimplemented!();
match mediaformat {
MediaFormat::Amr => { /* ... */ },
MediaFormat::Flac => { /* ... */ },
MediaFormat::Mp3 => { /* ... */ },
MediaFormat::Mp4 => { /* ... */ },
MediaFormat::Ogg => { /* ... */ },
MediaFormat::Wav => { /* ... */ },
MediaFormat::Webm => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when mediaformat represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant MediaFormat::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
MediaFormat::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 MediaFormat::NewFeature is defined.
Specifically, when mediaformat represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on MediaFormat::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
Amr
Flac
Mp3
Mp4
Ogg
Wav
Webm
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl MediaFormat
impl MediaFormat
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 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
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(())
}
pub fn serialize_structure_crate_input_start_transcription_job_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::StartTranscriptionJobInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_122) = &input.transcription_job_name {
object.key("TranscriptionJobName").string(var_122.as_str());
}
if let Some(var_123) = &input.language_code {
object.key("LanguageCode").string(var_123.as_str());
}
if let Some(var_124) = &input.media_sample_rate_hertz {
object.key("MediaSampleRateHertz").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_124).into()),
);
}
if let Some(var_125) = &input.media_format {
object.key("MediaFormat").string(var_125.as_str());
}
if let Some(var_126) = &input.media {
#[allow(unused_mut)]
let mut object_127 = object.key("Media").start_object();
crate::json_ser::serialize_structure_crate_model_media(&mut object_127, var_126)?;
object_127.finish();
}
if let Some(var_128) = &input.output_bucket_name {
object.key("OutputBucketName").string(var_128.as_str());
}
if let Some(var_129) = &input.output_key {
object.key("OutputKey").string(var_129.as_str());
}
if let Some(var_130) = &input.output_encryption_kms_key_id {
object
.key("OutputEncryptionKMSKeyId")
.string(var_130.as_str());
}
if let Some(var_131) = &input.kms_encryption_context {
#[allow(unused_mut)]
let mut object_132 = object.key("KMSEncryptionContext").start_object();
for (key_133, value_134) in var_131 {
{
object_132.key(key_133.as_str()).string(value_134.as_str());
}
}
object_132.finish();
}
if let Some(var_135) = &input.settings {
#[allow(unused_mut)]
let mut object_136 = object.key("Settings").start_object();
crate::json_ser::serialize_structure_crate_model_settings(&mut object_136, var_135)?;
object_136.finish();
}
if let Some(var_137) = &input.model_settings {
#[allow(unused_mut)]
let mut object_138 = object.key("ModelSettings").start_object();
crate::json_ser::serialize_structure_crate_model_model_settings(&mut object_138, var_137)?;
object_138.finish();
}
if let Some(var_139) = &input.job_execution_settings {
#[allow(unused_mut)]
let mut object_140 = object.key("JobExecutionSettings").start_object();
crate::json_ser::serialize_structure_crate_model_job_execution_settings(
&mut object_140,
var_139,
)?;
object_140.finish();
}
if let Some(var_141) = &input.content_redaction {
#[allow(unused_mut)]
let mut object_142 = object.key("ContentRedaction").start_object();
crate::json_ser::serialize_structure_crate_model_content_redaction(
&mut object_142,
var_141,
)?;
object_142.finish();
}
if let Some(var_143) = &input.identify_language {
object.key("IdentifyLanguage").boolean(*var_143);
}
if let Some(var_144) = &input.identify_multiple_languages {
object.key("IdentifyMultipleLanguages").boolean(*var_144);
}
if let Some(var_145) = &input.language_options {
let mut array_146 = object.key("LanguageOptions").start_array();
for item_147 in var_145 {
{
array_146.value().string(item_147.as_str());
}
}
array_146.finish();
}
if let Some(var_148) = &input.subtitles {
#[allow(unused_mut)]
let mut object_149 = object.key("Subtitles").start_object();
crate::json_ser::serialize_structure_crate_model_subtitles(&mut object_149, var_148)?;
object_149.finish();
}
if let Some(var_150) = &input.tags {
let mut array_151 = object.key("Tags").start_array();
for item_152 in var_150 {
{
#[allow(unused_mut)]
let mut object_153 = array_151.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_153, item_152)?;
object_153.finish();
}
}
array_151.finish();
}
if let Some(var_154) = &input.language_id_settings {
#[allow(unused_mut)]
let mut object_155 = object.key("LanguageIdSettings").start_object();
for (key_156, value_157) in var_154 {
{
#[allow(unused_mut)]
let mut object_158 = object_155.key(key_156.as_str()).start_object();
crate::json_ser::serialize_structure_crate_model_language_id_settings(
&mut object_158,
value_157,
)?;
object_158.finish();
}
}
object_155.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for MediaFormat
impl AsRef<str> for MediaFormat
source§impl Clone for MediaFormat
impl Clone for MediaFormat
source§fn clone(&self) -> MediaFormat
fn clone(&self) -> MediaFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for MediaFormat
impl Debug for MediaFormat
source§impl From<&str> for MediaFormat
impl From<&str> for MediaFormat
source§impl FromStr for MediaFormat
impl FromStr for MediaFormat
source§impl Hash for MediaFormat
impl Hash for MediaFormat
source§impl Ord for MediaFormat
impl Ord for MediaFormat
source§fn cmp(&self, other: &MediaFormat) -> Ordering
fn cmp(&self, other: &MediaFormat) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<MediaFormat> for MediaFormat
impl PartialEq<MediaFormat> for MediaFormat
source§fn eq(&self, other: &MediaFormat) -> bool
fn eq(&self, other: &MediaFormat) -> bool
source§impl PartialOrd<MediaFormat> for MediaFormat
impl PartialOrd<MediaFormat> for MediaFormat
source§fn partial_cmp(&self, other: &MediaFormat) -> Option<Ordering>
fn partial_cmp(&self, other: &MediaFormat) -> 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 MediaFormat
impl StructuralEq for MediaFormat
impl StructuralPartialEq for MediaFormat
Auto Trait Implementations§
impl RefUnwindSafe for MediaFormat
impl Send for MediaFormat
impl Sync for MediaFormat
impl Unpin for MediaFormat
impl UnwindSafe for MediaFormat
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.