aws_sdk_mediaconvert/types/_xavc_hd_profile_telecine.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// When writing a match expression against `XavcHdProfileTelecine`, it is important to ensure
4/// your code is forward-compatible. That is, if a match arm handles a case for a
5/// feature that is supported by the service but has not been represented as an enum
6/// variant in a current version of SDK, your code should continue to work when you
7/// upgrade SDK to a future version in which the enum does include a variant for that
8/// feature.
9///
10/// Here is an example of how you can make a match expression forward-compatible:
11///
12/// ```text
13/// # let xavchdprofiletelecine = unimplemented!();
14/// match xavchdprofiletelecine {
15/// XavcHdProfileTelecine::Hard => { /* ... */ },
16/// XavcHdProfileTelecine::None => { /* ... */ },
17/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
18/// _ => { /* ... */ },
19/// }
20/// ```
21/// The above code demonstrates that when `xavchdprofiletelecine` represents
22/// `NewFeature`, the execution path will lead to the second last match arm,
23/// even though the enum does not contain a variant `XavcHdProfileTelecine::NewFeature`
24/// in the current version of SDK. The reason is that the variable `other`,
25/// created by the `@` operator, is bound to
26/// `XavcHdProfileTelecine::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
27/// and calling `as_str` on it yields `"NewFeature"`.
28/// This match expression is forward-compatible when executed with a newer
29/// version of SDK where the variant `XavcHdProfileTelecine::NewFeature` is defined.
30/// Specifically, when `xavchdprofiletelecine` represents `NewFeature`,
31/// the execution path will hit the second last match arm as before by virtue of
32/// calling `as_str` on `XavcHdProfileTelecine::NewFeature` also yielding `"NewFeature"`.
33///
34/// Explicitly matching on the `Unknown` variant should
35/// be avoided for two reasons:
36/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
37/// - It might inadvertently shadow other intended match arms.
38///
39/// Ignore this setting unless you set Frame rate (framerateNumerator divided by framerateDenominator) to 29.970. If your input framerate is 23.976, choose Hard. Otherwise, keep the default value None. For more information, see https://docs.aws.amazon.com/mediaconvert/latest/ug/working-with-telecine-and-inverse-telecine.html.
40#[non_exhaustive]
41#[derive(
42 ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
43)]
44pub enum XavcHdProfileTelecine {
45 #[allow(missing_docs)] // documentation missing in model
46 Hard,
47 #[allow(missing_docs)] // documentation missing in model
48 None,
49 /// `Unknown` contains new variants that have been added since this code was generated.
50 #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
51 Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
52}
53impl ::std::convert::From<&str> for XavcHdProfileTelecine {
54 fn from(s: &str) -> Self {
55 match s {
56 "HARD" => XavcHdProfileTelecine::Hard,
57 "NONE" => XavcHdProfileTelecine::None,
58 other => XavcHdProfileTelecine::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
59 }
60 }
61}
62impl ::std::str::FromStr for XavcHdProfileTelecine {
63 type Err = ::std::convert::Infallible;
64
65 fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
66 ::std::result::Result::Ok(XavcHdProfileTelecine::from(s))
67 }
68}
69impl XavcHdProfileTelecine {
70 /// Returns the `&str` value of the enum member.
71 pub fn as_str(&self) -> &str {
72 match self {
73 XavcHdProfileTelecine::Hard => "HARD",
74 XavcHdProfileTelecine::None => "NONE",
75 XavcHdProfileTelecine::Unknown(value) => value.as_str(),
76 }
77 }
78 /// Returns all the `&str` representations of the enum members.
79 pub const fn values() -> &'static [&'static str] {
80 &["HARD", "NONE"]
81 }
82}
83impl ::std::convert::AsRef<str> for XavcHdProfileTelecine {
84 fn as_ref(&self) -> &str {
85 self.as_str()
86 }
87}
88impl XavcHdProfileTelecine {
89 /// Parses the enum value while disallowing unknown variants.
90 ///
91 /// Unknown variants will result in an error.
92 pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
93 match Self::from(value) {
94 #[allow(deprecated)]
95 Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
96 known => Ok(known),
97 }
98 }
99}
100impl ::std::fmt::Display for XavcHdProfileTelecine {
101 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
102 match self {
103 XavcHdProfileTelecine::Hard => write!(f, "HARD"),
104 XavcHdProfileTelecine::None => write!(f, "NONE"),
105 XavcHdProfileTelecine::Unknown(value) => write!(f, "{}", value),
106 }
107 }
108}