Skip to main content

InterstitialDateRange

Struct InterstitialDateRange 

Source
pub struct InterstitialDateRange {
    pub id: String,
    pub start_date: String,
    pub duration: Option<f64>,
    pub asset: AssetSource,
    pub resume_offset: Option<f64>,
    pub playout_limit: Option<f64>,
    pub snap: Vec<SnapMode>,
    pub restrict: Vec<RestrictMode>,
}
Expand description

A rendered Interstitial EXT-X-DATERANGE tag: an AdBreakDecision plus the base-tag scheduling fields (START-DATE, DURATION, RFC 8216bis §4.4.5.1) the decision itself does not carry.

Fields§

§id: String

ID (quoted).

§start_date: String

START-DATE (quoted, ISO-8601/RFC3339) — caller-supplied; this module does no wall-clock math.

§duration: Option<f64>

DURATION in seconds, if known.

§asset: AssetSource

X-ASSET-URI or X-ASSET-LIST.

§resume_offset: Option<f64>

X-RESUME-OFFSET in seconds.

§playout_limit: Option<f64>

X-PLAYOUT-LIMIT in seconds.

§snap: Vec<SnapMode>

X-SNAP identifiers.

§restrict: Vec<RestrictMode>

X-RESTRICT identifiers.

Implementations§

Source§

impl InterstitialDateRange

Source

pub fn from_decision( decision: &AdBreakDecision, start_date: impl Into<String>, duration: Option<f64>, ) -> Self

Build from an AdBreakDecision plus the two base-tag fields it doesn’t carry.

Source

pub fn to_tag_line(&self) -> Result<String>

Render one #EXT-X-DATERANGE: line. Attribute order is fixed (ID, CLASS, START-DATE, DURATION, X-ASSET-URI/X-ASSET-LIST, X-RESUME-OFFSET, X-PLAYOUT-LIMIT, X-SNAP, X-RESTRICT) so Self::parse_tag_line round-trips. Built solely from the typed fields above — no stored source span is echoed.

Every attribute value goes through AttrValue::quoted/bare (issue #1140 / audit r14-SSAI-W1) before broadcast_hls::render_attribute_list renders it: id, start_date and the asset URI/list are frequently supplied (directly or indirectly) by an crate::decision::AdDecisionProvider — a third-party ad-decision service — so a ", CR or LF in any of them is rejected here rather than terminating the attribute list and injecting arbitrary tag lines into the session playlist. duration/ resume_offset/playout_limit must also be finite and non-negative (audit r14-SSAI-W4) — Error::InvalidDuration otherwise.

Source

pub fn parse_tag_line(s: &str) -> Result<Self>

Parse one #EXT-X-DATERANGE: line with CLASS="com.apple.hls.interstitial". Errors with Error::TagParse if the CLASS doesn’t match (or is missing) or a required attribute is absent, and Error::InvalidAssetSource if neither or both of X-ASSET-URI/X-ASSET-LIST are present.

Trait Implementations§

Source§

impl Clone for InterstitialDateRange

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InterstitialDateRange

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for InterstitialDateRange

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InterstitialDateRange

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.