pub struct SessionData<'a> { /* private fields */ }Expand description
Corresponds to the #EXT-X-SESSION-DATA tag.
https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-18#section-4.4.6.4
Implementations§
Source§impl<'a> SessionData<'a>
impl<'a> SessionData<'a>
Sourcepub fn builder() -> SessionDataBuilder<'a, SessionDataDataIdNeedsToBeSet, SessionDataValueIsNotSet, SessionDataUriIsNotSet>
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");Sourcepub fn data_id(&self) -> &str
pub fn data_id(&self) -> &str
Corresponds to the DATA-ID attribute.
See Self for a link to the HLS documentation for this attribute.
Sourcepub fn value(&self) -> Option<&str>
pub fn value(&self) -> Option<&str>
Corresponds to the VALUE attribute.
See Self for a link to the HLS documentation for this attribute.
Sourcepub fn uri(&self) -> Option<&str>
pub fn uri(&self) -> Option<&str>
Corresponds to the URI attribute.
See Self for a link to the HLS documentation for this attribute.
Sourcepub fn format(&self) -> EnumeratedString<'_, Format>
pub fn format(&self) -> EnumeratedString<'_, Format>
Corresponds to the FORMAT attribute.
See Self for a link to the HLS documentation for this attribute.
Sourcepub fn language(&self) -> Option<&str>
pub fn language(&self) -> Option<&str>
Corresponds to the LANGUAGE attribute.
See Self for a link to the HLS documentation for this attribute.
Sourcepub fn set_data_id(&mut self, data_id: impl Into<Cow<'a, str>>)
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.
Sourcepub fn set_value(&mut self, value: impl Into<Cow<'a, str>>)
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.
Sourcepub fn unset_value(&mut self)
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.
Sourcepub fn set_uri(&mut self, uri: impl Into<Cow<'a, str>>)
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.
Sourcepub fn unset_uri(&mut self)
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.
Sourcepub fn set_format(&mut self, format: impl Into<Cow<'a, str>>)
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.
Sourcepub fn unset_format(&mut self)
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.
Sourcepub fn set_language(&mut self, language: impl Into<Cow<'a, str>>)
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.
Sourcepub fn unset_language(&mut self)
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>
impl<'a> Clone for SessionData<'a>
Source§fn clone(&self) -> SessionData<'a>
fn clone(&self) -> SessionData<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for SessionData<'a>
impl<'a> Debug for SessionData<'a>
Source§impl<'a, Custom> From<SessionData<'a>> for HlsLine<'a, Custom>where
Custom: CustomTag<'a>,
impl<'a, Custom> From<SessionData<'a>> for HlsLine<'a, Custom>where
Custom: CustomTag<'a>,
Source§fn from(tag: SessionData<'a>) -> Self
fn from(tag: SessionData<'a>) -> Self
Source§impl<'a> IntoInnerTag<'a> for SessionData<'a>
impl<'a> IntoInnerTag<'a> for SessionData<'a>
Source§fn into_inner(self) -> TagInner<'a>
fn into_inner(self) -> TagInner<'a>
self and provide TagInner.