Skip to main content

UnknownTag

Struct UnknownTag 

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

A tag that is unknown to the library found during parsing input data.

This may be because the tag is truly unknown (i.e., is not one of the 32 supported HLS defined tags), or because the known tag has been ignored via crate::config::ParsingOptions, or also if there was an error in parsing the known tag. In the last case, the Self::validation_error will provide details on the problem encountered.

Despite not being “fully parsed”, the TagValue provided in Self::value provides many methods useful for extracting more information from the tag value, and is what all the library defined HLS tags use to parse into more strongly defined data structures.

For example:

let lines = r#"#EXT-X-QUESTION:VALUE="Do you know who I am?"
#EXT-X-PROGRAM-DATE-TIME:2025-08-05T21:59:42.417-05:00
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=10000000"#;

let mut reader = Reader::from_str(
    lines,
    ParsingOptionsBuilder::new()
        .with_parsing_for_stream_inf()
        .build()
);

// #EXT-X-QUESTION:VALUE="Do you know who I am?"
let Ok(Some(HlsLine::UnknownTag(tag))) = reader.read_line() else { panic!("unexpected tag") };
assert_eq!("-X-QUESTION", tag.name());
assert_eq!(Some(TagValue(r#"VALUE="Do you know who I am?""#.as_bytes())), tag.value());
assert_eq!(None, tag.validation_error());
assert_eq!(r#"#EXT-X-QUESTION:VALUE="Do you know who I am?""#.as_bytes(), tag.as_bytes());

// #EXT-X-PROGRAM-DATE-TIME:2025-08-05T21:59:42.417-05:00
let Ok(Some(HlsLine::UnknownTag(tag))) = reader.read_line() else { panic!("unexpected tag") };
assert_eq!("-X-PROGRAM-DATE-TIME", tag.name());
assert_eq!(Some(TagValue("2025-08-05T21:59:42.417-05:00".as_bytes())), tag.value());
assert_eq!(None, tag.validation_error());
assert_eq!(
    "#EXT-X-PROGRAM-DATE-TIME:2025-08-05T21:59:42.417-05:00".as_bytes(),
    tag.as_bytes()
);

// #EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=10000000
let Ok(Some(HlsLine::UnknownTag(tag))) = reader.read_line() else { panic!("unexpected tag") };
assert_eq!("-X-STREAM-INF", tag.name());
assert_eq!(Some(TagValue("AVERAGE-BANDWIDTH=10000000".as_bytes())), tag.value());
assert_eq!(
    Some(ValidationError::MissingRequiredAttribute("BANDWIDTH")),
    tag.validation_error()
);
assert_eq!(
    "#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=10000000".as_bytes(),
    tag.as_bytes()
);

Implementations§

Source§

impl<'a> UnknownTag<'a>

Source

pub fn name(&self) -> &'a str

The name of the unknown tag.

This includes everything after the #EXT prefix and before the : or new line. For example, #EXTM3U has name M3U, #EXT-X-VERSION:3 has name -X-VERSION, etc.

Source

pub fn value(&self) -> Option<TagValue<'a>>

The value of the unknown tag.

This will be the entire byte-slice after the first : in the line. If there is no : then this will be None. The slice borrow is wrapped in TagValue which provides many methods for converting to a more suitable data structure depending on the tag. See the documentation for TagValue for more information.

Source

pub fn validation_error(&self) -> Option<ValidationError>

The error that led to this tag being unknown.

This value is only Some if the tag is unknown as the result of a problem in parsing a known tag.

Source

pub fn as_bytes(&self) -> &'a [u8]

The raw bytes of the tag line for output.

This is useful for when the tag needs to be writtern to an output.

Trait Implementations§

Source§

impl<'a> Clone for UnknownTag<'a>

Source§

fn clone(&self) -> UnknownTag<'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 UnknownTag<'a>

Source§

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

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

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

Source§

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

Converts to this type from the input type.
Source§

impl<'a> PartialEq for UnknownTag<'a>

Source§

fn eq(&self, other: &UnknownTag<'a>) -> 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 TryFrom<UnknownTag<'_>> for Discontinuity

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl TryFrom<UnknownTag<'_>> for Endlist

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl TryFrom<UnknownTag<'_>> for Gap

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl TryFrom<UnknownTag<'_>> for IFramesOnly

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl TryFrom<UnknownTag<'_>> for IndependentSegments

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl TryFrom<UnknownTag<'_>> for M3u

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl TryFrom<UnknownTag<'_>> for NoCustomTag

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl TryFrom<UnknownTag<'_>> for PlaylistType

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Bitrate<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Byterange<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for ContentSteering<'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.
Source§

impl<'a, Custom> TryFrom<UnknownTag<'a>> for CustomTagAccess<'a, Custom>
where Custom: CustomTag<'a>,

Source§

type Error = ValidationError

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

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

Performs the conversion.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Daterange<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Define<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for DiscontinuitySequence<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for IFrameStreamInf<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Inf<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Key<'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.
Source§

impl<'a, Custom> TryFrom<UnknownTag<'a>> for KnownTag<'a, Custom>
where Custom: CustomTag<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Map<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Media<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for MediaSequence<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Part<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for PartInf<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for PreloadHint<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for ProgramDateTime<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for RenditionReport<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for ServerControl<'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.
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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for SessionKey<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Skip<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Start<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for StreamInf<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Tag<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Targetduration<'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.
Source§

impl<'a> TryFrom<UnknownTag<'a>> for Version<'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.
Source§

impl<'a> Copy for UnknownTag<'a>

Source§

impl<'a> StructuralPartialEq for UnknownTag<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for UnknownTag<'a>

§

impl<'a> RefUnwindSafe for UnknownTag<'a>

§

impl<'a> Send for UnknownTag<'a>

§

impl<'a> Sync for UnknownTag<'a>

§

impl<'a> Unpin for UnknownTag<'a>

§

impl<'a> UnsafeUnpin for UnknownTag<'a>

§

impl<'a> UnwindSafe for UnknownTag<'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.