#[non_exhaustive]pub enum Content {
Show 15 variants
Text(String),
ExtendedText(ExtendedText),
Link(String),
ExtendedLink(ExtendedLink),
Comment(Comment),
Popularimeter(Popularimeter),
Lyrics(Lyrics),
SynchronisedLyrics(SynchronisedLyrics),
Picture(Picture),
EncapsulatedObject(EncapsulatedObject),
Chapter(Chapter),
MpegLocationLookupTable(MpegLocationLookupTable),
Private(Private),
TableOfContents(TableOfContents),
Unknown(Unknown),
}
Expand description
The decoded contents of a Frame
.
§Compatibility
It is important to note that the ID3 spec has a variety of extensions of which not all are implemented by this library. When a new frame content type is added, the signature of this enum changes. Hence, the non_exhaustive attribute is set.
However, when a new frame type variant is added, frames that would previously decode to
Unknown
are now decoded to their new variants. This would break user code, such as custom
decoders, that was expecting Unknown
.
In order to prevent breakage when this library adds a new frame type, users must use the
Content::to_unknown
method which will return an Unknown
regardlesss of whether the
frame content was successfully decoded.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(String)
A value containing the parsed contents of a text frame.
ExtendedText(ExtendedText)
A value containing the parsed contents of a user defined text frame (TXXX).
Link(String)
A value containing the parsed contents of a web link frame.
ExtendedLink(ExtendedLink)
A value containing the parsed contents of a user defined web link frame (WXXX).
Comment(Comment)
A value containing the parsed contents of a comment frame (COMM).
Popularimeter(Popularimeter)
Popularimeter frame content (POPM).
Lyrics(Lyrics)
A value containing the parsed contents of a lyrics frame (USLT).
SynchronisedLyrics(SynchronisedLyrics)
A value containing the parsed contents of a synchronised lyrics frame (SYLT).
Picture(Picture)
A value containing the parsed contents of a picture frame (APIC).
EncapsulatedObject(EncapsulatedObject)
A value containing the parsed contents of a general encapsulated object frame (GEOB).
Chapter(Chapter)
A chapter object containing frames by itself (CHAP).
MpegLocationLookupTable(MpegLocationLookupTable)
MPEG location lookup table content (MLLT).
Private(Private)
A private frame (PRIV)
TableOfContents(TableOfContents)
A value containing the parsed contents of a table of contents frame (CTOC).
Unknown(Unknown)
A value containing the bytes of a currently unknown frame type.
Users that wish to write custom decoders must use Content::to_unknown
instead of
matching on this variant. See the compatibility note in the top level enum docs.
Implementations§
source§impl Content
impl Content
sourcepub fn new_text_values(
texts: impl IntoIterator<Item = impl Into<String>>
) -> Self
pub fn new_text_values( texts: impl IntoIterator<Item = impl Into<String>> ) -> Self
sourcepub fn text_values(&self) -> Option<impl Iterator<Item = &str>>
pub fn text_values(&self) -> Option<impl Iterator<Item = &str>>
Returns split values of the Text
frame or None if the value is not Text
. This is only
useful for ID3v2.4 tags, which support text frames containing multiple values separated by
null bytes. This method returns an iterator over the separated values.
sourcepub fn extended_text(&self) -> Option<&ExtendedText>
pub fn extended_text(&self) -> Option<&ExtendedText>
Returns the ExtendedText
or None if the value is not ExtendedText
.
sourcepub fn extended_link(&self) -> Option<&ExtendedLink>
pub fn extended_link(&self) -> Option<&ExtendedLink>
Returns the ExtendedLink
or None if the value is not ExtendedLink
.
sourcepub fn encapsulated_object(&self) -> Option<&EncapsulatedObject>
pub fn encapsulated_object(&self) -> Option<&EncapsulatedObject>
Returns the EncapsulatedObject
or None if the value is not EncapsulatedObject
.
sourcepub fn comment(&self) -> Option<&Comment>
pub fn comment(&self) -> Option<&Comment>
Returns the Comment
or None if the value is not Comment
.
sourcepub fn synchronised_lyrics(&self) -> Option<&SynchronisedLyrics>
pub fn synchronised_lyrics(&self) -> Option<&SynchronisedLyrics>
Returns the SynchronisedLyrics
or None if the value is not SynchronisedLyrics
.
sourcepub fn picture(&self) -> Option<&Picture>
pub fn picture(&self) -> Option<&Picture>
Returns the Picture
or None if the value is not Picture
.
sourcepub fn chapter(&self) -> Option<&Chapter>
pub fn chapter(&self) -> Option<&Chapter>
Returns the Chapter
or None if the value is not Chapter
.
sourcepub fn mpeg_location_lookup_table(&self) -> Option<&MpegLocationLookupTable>
pub fn mpeg_location_lookup_table(&self) -> Option<&MpegLocationLookupTable>
Returns the MpegLocationLookupTable
or None if the value is not
MpegLocationLookupTable
.
sourcepub fn popularimeter(&self) -> Option<&Popularimeter>
pub fn popularimeter(&self) -> Option<&Popularimeter>
Returns the Popularimeter
or None if the value is not
Popularimeter
sourcepub fn table_of_contents(&self) -> Option<&TableOfContents>
pub fn table_of_contents(&self) -> Option<&TableOfContents>
Returns the TableOfContents
or None if the value is not TableOfContents
.
sourcepub fn unknown(&self) -> Option<&[u8]>
👎Deprecated: Use to_unknown
pub fn unknown(&self) -> Option<&[u8]>
Returns the Unknown
or None if the value is not Unknown
.
sourcepub fn to_unknown(&self) -> Result<Cow<'_, Unknown>>
pub fn to_unknown(&self) -> Result<Cow<'_, Unknown>>
Returns the Unknown
variant or an ad-hoc encoding of any other variant.
See the compatibility note on the docs of Content
for the reason of why this function
exists.
Trait Implementations§
source§impl Ord for Content
impl Ord for Content
source§impl PartialEq for Content
impl PartialEq for Content
source§impl PartialOrd for Content
impl PartialOrd for Content
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 more