#[non_exhaustive]
pub enum ManifestLayout {
Compact,
Full,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against ManifestLayout
, 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 manifestlayout = unimplemented!();
match manifestlayout {
ManifestLayout::Compact => { /* ... */ },
ManifestLayout::Full => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when manifestlayout
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant ManifestLayout::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
ManifestLayout::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 ManifestLayout::NewFeature
is defined.
Specifically, when manifestlayout
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on ManifestLayout::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
Compact
Full
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl ManifestLayout
impl ManifestLayout
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
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
pub fn serialize_structure_crate_model_dash_package(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::DashPackage,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_76) = &input.ad_triggers {
let mut array_77 = object.key("adTriggers").start_array();
for item_78 in var_76 {
{
array_77.value().string(item_78.as_str());
}
}
array_77.finish();
}
if let Some(var_79) = &input.ads_on_delivery_restrictions {
object
.key("adsOnDeliveryRestrictions")
.string(var_79.as_str());
}
if let Some(var_80) = &input.encryption {
#[allow(unused_mut)]
let mut object_81 = object.key("encryption").start_object();
crate::json_ser::serialize_structure_crate_model_dash_encryption(&mut object_81, var_80)?;
object_81.finish();
}
if input.include_iframe_only_stream {
object
.key("includeIframeOnlyStream")
.boolean(input.include_iframe_only_stream);
}
if let Some(var_82) = &input.manifest_layout {
object.key("manifestLayout").string(var_82.as_str());
}
if input.manifest_window_seconds != 0 {
object.key("manifestWindowSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.manifest_window_seconds).into()),
);
}
if input.min_buffer_time_seconds != 0 {
object.key("minBufferTimeSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.min_buffer_time_seconds).into()),
);
}
if input.min_update_period_seconds != 0 {
object.key("minUpdatePeriodSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.min_update_period_seconds).into()),
);
}
if let Some(var_83) = &input.period_triggers {
let mut array_84 = object.key("periodTriggers").start_array();
for item_85 in var_83 {
{
array_84.value().string(item_85.as_str());
}
}
array_84.finish();
}
if let Some(var_86) = &input.profile {
object.key("profile").string(var_86.as_str());
}
if input.segment_duration_seconds != 0 {
object.key("segmentDurationSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.segment_duration_seconds).into()),
);
}
if let Some(var_87) = &input.segment_template_format {
object.key("segmentTemplateFormat").string(var_87.as_str());
}
if let Some(var_88) = &input.stream_selection {
#[allow(unused_mut)]
let mut object_89 = object.key("streamSelection").start_object();
crate::json_ser::serialize_structure_crate_model_stream_selection(&mut object_89, var_88)?;
object_89.finish();
}
if input.suggested_presentation_delay_seconds != 0 {
object.key("suggestedPresentationDelaySeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.suggested_presentation_delay_seconds).into()),
);
}
if let Some(var_90) = &input.utc_timing {
object.key("utcTiming").string(var_90.as_str());
}
if let Some(var_91) = &input.utc_timing_uri {
object.key("utcTimingUri").string(var_91.as_str());
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for ManifestLayout
impl AsRef<str> for ManifestLayout
source§impl Clone for ManifestLayout
impl Clone for ManifestLayout
source§fn clone(&self) -> ManifestLayout
fn clone(&self) -> ManifestLayout
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ManifestLayout
impl Debug for ManifestLayout
source§impl From<&str> for ManifestLayout
impl From<&str> for ManifestLayout
source§impl FromStr for ManifestLayout
impl FromStr for ManifestLayout
source§impl Hash for ManifestLayout
impl Hash for ManifestLayout
source§impl Ord for ManifestLayout
impl Ord for ManifestLayout
source§fn cmp(&self, other: &ManifestLayout) -> Ordering
fn cmp(&self, other: &ManifestLayout) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ManifestLayout> for ManifestLayout
impl PartialEq<ManifestLayout> for ManifestLayout
source§fn eq(&self, other: &ManifestLayout) -> bool
fn eq(&self, other: &ManifestLayout) -> bool
source§impl PartialOrd<ManifestLayout> for ManifestLayout
impl PartialOrd<ManifestLayout> for ManifestLayout
source§fn partial_cmp(&self, other: &ManifestLayout) -> Option<Ordering>
fn partial_cmp(&self, other: &ManifestLayout) -> 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 ManifestLayout
impl StructuralEq for ManifestLayout
impl StructuralPartialEq for ManifestLayout
Auto Trait Implementations§
impl RefUnwindSafe for ManifestLayout
impl Send for ManifestLayout
impl Sync for ManifestLayout
impl Unpin for ManifestLayout
impl UnwindSafe for ManifestLayout
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.