Skip to main content

SessionData

Struct SessionData 

Source
pub struct SessionData<'a> { /* private fields */ }
Expand description

Implementations§

Source§

impl<'a> SessionData<'a>

Source

pub fn builder() -> SessionDataBuilder<'a, SessionDataDataIdNeedsToBeSet, SessionDataValueIsNotSet, SessionDataUriIsNotSet>

Starts a builder for producing Self.

For example, we could construct a SessionData as such:

let session_data = SessionData::builder()
    .with_data_id("1234")
    .with_uri("data.bin")
    .with_format(Format::Raw)
    .finish();

Note that the HLS specification indicates:

Each EXT-X-SESSION-DATA tag MUST contain either a VALUE or URI attribute, but not both.

This is enforced with the builder, meaning, the finish method is only available once the data_id attribute has been set and either the value or uri attribute. Further, the uri attribute can only be set when value has not been set, and similarly, value can only be set when uri has not been set. Each of the following fail to compile:

let session_data = SessionData::builder().finish();
let session_data = SessionData::builder().with_data_id("1234").finish();
let session_data_builder = SessionData::builder().with_value("test").with_uri("data.bin");
let session_data_builder = SessionData::builder().with_uri("data.bin").with_value("test");
Source

pub fn data_id(&self) -> &str

Corresponds to the DATA-ID attribute.

See Self for a link to the HLS documentation for this attribute.

Source

pub fn value(&self) -> Option<&str>

Corresponds to the VALUE attribute.

See Self for a link to the HLS documentation for this attribute.

Source

pub fn uri(&self) -> Option<&str>

Corresponds to the URI attribute.

See Self for a link to the HLS documentation for this attribute.

Source

pub fn format(&self) -> EnumeratedString<'_, Format>

Corresponds to the FORMAT attribute.

See Self for a link to the HLS documentation for this attribute.

Source

pub fn language(&self) -> Option<&str>

Corresponds to the LANGUAGE attribute.

See Self for a link to the HLS documentation for this attribute.

Source

pub fn set_data_id(&mut self, data_id: impl Into<Cow<'a, str>>)

Sets the DATA-ID attribute.

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn set_value(&mut self, value: impl Into<Cow<'a, str>>)

Sets the VALUE attribute.

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn unset_value(&mut self)

Unsets the VALUE attribute (sets it to None).

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn set_uri(&mut self, uri: impl Into<Cow<'a, str>>)

Sets the URI attribute.

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn unset_uri(&mut self)

Unsets the URI attribute (sets it to None).

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn set_format(&mut self, format: impl Into<Cow<'a, str>>)

Sets the FORMAT attribute.

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn unset_format(&mut self)

Unsets the FORMAT attribute (sets it to None).

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn set_language(&mut self, language: impl Into<Cow<'a, str>>)

Sets the LANGUAGE attribute.

See SessionData for a link to the HLS documentation for this attribute.

Source

pub fn unset_language(&mut self)

Unsets the LANGUAGE attribute (sets it to None).

See SessionData for a link to the HLS documentation for this attribute.

Trait Implementations§

Source§

impl<'a> Clone for SessionData<'a>

Source§

fn clone(&self) -> SessionData<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for SessionData<'a>

Source§

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

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

impl<'a, Custom> From<SessionData<'a>> for HlsLine<'a, Custom>
where Custom: CustomTag<'a>,

Source§

fn from(tag: SessionData<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> IntoInnerTag<'a> for SessionData<'a>

Source§

fn into_inner(self) -> TagInner<'a>

Consume self and provide TagInner.
Source§

impl<'a> PartialEq for SessionData<'a>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for SessionData<'a>

Source§

type Error = ValidationError

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

fn try_from(tag: UnknownTag<'a>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for SessionData<'a>

§

impl<'a> RefUnwindSafe for SessionData<'a>

§

impl<'a> Send for SessionData<'a>

§

impl<'a> Sync for SessionData<'a>

§

impl<'a> Unpin for SessionData<'a>

§

impl<'a> UnsafeUnpin for SessionData<'a>

§

impl<'a> UnwindSafe for SessionData<'a>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.