Enum aws_sdk_mediapackage::model::AdMarkers
source · #[non_exhaustive]
pub enum AdMarkers {
Daterange,
None,
Passthrough,
Scte35Enhanced,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against AdMarkers
, 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 admarkers = unimplemented!();
match admarkers {
AdMarkers::Daterange => { /* ... */ },
AdMarkers::None => { /* ... */ },
AdMarkers::Passthrough => { /* ... */ },
AdMarkers::Scte35Enhanced => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when admarkers
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant AdMarkers::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
AdMarkers::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 AdMarkers::NewFeature
is defined.
Specifically, when admarkers
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on AdMarkers::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
Daterange
None
Passthrough
Scte35Enhanced
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl AdMarkers
impl AdMarkers
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
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 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
pub fn serialize_structure_crate_model_hls_package(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::HlsPackage,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_92) = &input.ad_markers {
object.key("adMarkers").string(var_92.as_str());
}
if let Some(var_93) = &input.ad_triggers {
let mut array_94 = object.key("adTriggers").start_array();
for item_95 in var_93 {
{
array_94.value().string(item_95.as_str());
}
}
array_94.finish();
}
if let Some(var_96) = &input.ads_on_delivery_restrictions {
object
.key("adsOnDeliveryRestrictions")
.string(var_96.as_str());
}
if let Some(var_97) = &input.encryption {
#[allow(unused_mut)]
let mut object_98 = object.key("encryption").start_object();
crate::json_ser::serialize_structure_crate_model_hls_encryption(&mut object_98, var_97)?;
object_98.finish();
}
if input.include_dvb_subtitles {
object
.key("includeDvbSubtitles")
.boolean(input.include_dvb_subtitles);
}
if input.include_iframe_only_stream {
object
.key("includeIframeOnlyStream")
.boolean(input.include_iframe_only_stream);
}
if let Some(var_99) = &input.playlist_type {
object.key("playlistType").string(var_99.as_str());
}
if input.playlist_window_seconds != 0 {
object.key("playlistWindowSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.playlist_window_seconds).into()),
);
}
if input.program_date_time_interval_seconds != 0 {
object.key("programDateTimeIntervalSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.program_date_time_interval_seconds).into()),
);
}
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_100) = &input.stream_selection {
#[allow(unused_mut)]
let mut object_101 = object.key("streamSelection").start_object();
crate::json_ser::serialize_structure_crate_model_stream_selection(
&mut object_101,
var_100,
)?;
object_101.finish();
}
if input.use_audio_rendition_group {
object
.key("useAudioRenditionGroup")
.boolean(input.use_audio_rendition_group);
}
Ok(())
}
pub fn serialize_structure_crate_model_mss_package(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::MssPackage,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_102) = &input.encryption {
#[allow(unused_mut)]
let mut object_103 = object.key("encryption").start_object();
crate::json_ser::serialize_structure_crate_model_mss_encryption(&mut object_103, var_102)?;
object_103.finish();
}
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.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_104) = &input.stream_selection {
#[allow(unused_mut)]
let mut object_105 = object.key("streamSelection").start_object();
crate::json_ser::serialize_structure_crate_model_stream_selection(
&mut object_105,
var_104,
)?;
object_105.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_cmaf_encryption(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CmafEncryption,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_106) = &input.constant_initialization_vector {
object
.key("constantInitializationVector")
.string(var_106.as_str());
}
if let Some(var_107) = &input.encryption_method {
object.key("encryptionMethod").string(var_107.as_str());
}
if input.key_rotation_interval_seconds != 0 {
object.key("keyRotationIntervalSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.key_rotation_interval_seconds).into()),
);
}
if let Some(var_108) = &input.speke_key_provider {
#[allow(unused_mut)]
let mut object_109 = object.key("spekeKeyProvider").start_object();
crate::json_ser::serialize_structure_crate_model_speke_key_provider(
&mut object_109,
var_108,
)?;
object_109.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_hls_manifest_create_or_update_parameters(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::HlsManifestCreateOrUpdateParameters,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_110) = &input.ad_markers {
object.key("adMarkers").string(var_110.as_str());
}
if let Some(var_111) = &input.ad_triggers {
let mut array_112 = object.key("adTriggers").start_array();
for item_113 in var_111 {
{
array_112.value().string(item_113.as_str());
}
}
array_112.finish();
}
if let Some(var_114) = &input.ads_on_delivery_restrictions {
object
.key("adsOnDeliveryRestrictions")
.string(var_114.as_str());
}
if let Some(var_115) = &input.id {
object.key("id").string(var_115.as_str());
}
if input.include_iframe_only_stream {
object
.key("includeIframeOnlyStream")
.boolean(input.include_iframe_only_stream);
}
if let Some(var_116) = &input.manifest_name {
object.key("manifestName").string(var_116.as_str());
}
if let Some(var_117) = &input.playlist_type {
object.key("playlistType").string(var_117.as_str());
}
if input.playlist_window_seconds != 0 {
object.key("playlistWindowSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.playlist_window_seconds).into()),
);
}
if input.program_date_time_interval_seconds != 0 {
object.key("programDateTimeIntervalSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.program_date_time_interval_seconds).into()),
);
}
Ok(())
}
Trait Implementations§
source§impl Ord for AdMarkers
impl Ord for AdMarkers
source§impl PartialOrd<AdMarkers> for AdMarkers
impl PartialOrd<AdMarkers> for AdMarkers
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 AdMarkers
impl StructuralEq for AdMarkers
impl StructuralPartialEq for AdMarkers
Auto Trait Implementations§
impl RefUnwindSafe for AdMarkers
impl Send for AdMarkers
impl Sync for AdMarkers
impl Unpin for AdMarkers
impl UnwindSafe for AdMarkers
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.