#[non_exhaustive]
pub enum AdsOnDeliveryRestrictions {
Both,
None,
Restricted,
Unrestricted,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against AdsOnDeliveryRestrictions
, 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 adsondeliveryrestrictions = unimplemented!();
match adsondeliveryrestrictions {
AdsOnDeliveryRestrictions::Both => { /* ... */ },
AdsOnDeliveryRestrictions::None => { /* ... */ },
AdsOnDeliveryRestrictions::Restricted => { /* ... */ },
AdsOnDeliveryRestrictions::Unrestricted => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when adsondeliveryrestrictions
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant AdsOnDeliveryRestrictions::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
AdsOnDeliveryRestrictions::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 AdsOnDeliveryRestrictions::NewFeature
is defined.
Specifically, when adsondeliveryrestrictions
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on AdsOnDeliveryRestrictions::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. This setting allows the delivery restriction flags on SCTE-35 segmentation descriptors to determine whether a message signals an ad. Choosing “NONE” means no SCTE-35 messages become ads. Choosing “RESTRICTED” means SCTE-35 messages of the types specified in AdTriggers that contain delivery restrictions will be treated as ads. Choosing “UNRESTRICTED” means SCTE-35 messages of the types specified in AdTriggers that do not contain delivery restrictions will be treated as ads. Choosing “BOTH” means all SCTE-35 messages of the types specified in AdTriggers will be treated as ads. Note that Splice Insert messages do not have these flags and are always treated as ads if specified in AdTriggers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Both
None
Restricted
Unrestricted
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl AdsOnDeliveryRestrictions
impl AdsOnDeliveryRestrictions
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 432 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_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(())
}
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 AsRef<str> for AdsOnDeliveryRestrictions
impl AsRef<str> for AdsOnDeliveryRestrictions
source§impl Clone for AdsOnDeliveryRestrictions
impl Clone for AdsOnDeliveryRestrictions
source§fn clone(&self) -> AdsOnDeliveryRestrictions
fn clone(&self) -> AdsOnDeliveryRestrictions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AdsOnDeliveryRestrictions
impl Debug for AdsOnDeliveryRestrictions
source§impl From<&str> for AdsOnDeliveryRestrictions
impl From<&str> for AdsOnDeliveryRestrictions
source§impl FromStr for AdsOnDeliveryRestrictions
impl FromStr for AdsOnDeliveryRestrictions
source§impl Hash for AdsOnDeliveryRestrictions
impl Hash for AdsOnDeliveryRestrictions
source§impl Ord for AdsOnDeliveryRestrictions
impl Ord for AdsOnDeliveryRestrictions
source§fn cmp(&self, other: &AdsOnDeliveryRestrictions) -> Ordering
fn cmp(&self, other: &AdsOnDeliveryRestrictions) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<AdsOnDeliveryRestrictions> for AdsOnDeliveryRestrictions
impl PartialEq<AdsOnDeliveryRestrictions> for AdsOnDeliveryRestrictions
source§fn eq(&self, other: &AdsOnDeliveryRestrictions) -> bool
fn eq(&self, other: &AdsOnDeliveryRestrictions) -> bool
source§impl PartialOrd<AdsOnDeliveryRestrictions> for AdsOnDeliveryRestrictions
impl PartialOrd<AdsOnDeliveryRestrictions> for AdsOnDeliveryRestrictions
source§fn partial_cmp(&self, other: &AdsOnDeliveryRestrictions) -> Option<Ordering>
fn partial_cmp(&self, other: &AdsOnDeliveryRestrictions) -> 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 AdsOnDeliveryRestrictions
impl StructuralEq for AdsOnDeliveryRestrictions
impl StructuralPartialEq for AdsOnDeliveryRestrictions
Auto Trait Implementations§
impl RefUnwindSafe for AdsOnDeliveryRestrictions
impl Send for AdsOnDeliveryRestrictions
impl Sync for AdsOnDeliveryRestrictions
impl Unpin for AdsOnDeliveryRestrictions
impl UnwindSafe for AdsOnDeliveryRestrictions
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.