#[non_exhaustive]
pub enum Content {
Show 13 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),
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 code user, 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).
Unknown(Unknown)
A value containing the bytes of a currently unknown frame type.
Users that wish to write custom decoders must use as_raw instead of matching on this variant. See the compatibility note in the top level enum docs.
Implementations
sourceimpl 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 unknown(&self) -> Option<&[u8]>
👎 Deprecated: Use to_unknown
pub fn unknown(&self) -> Option<&[u8]>
Use to_unknown
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
sourceimpl Ord for Content
impl Ord for Content
sourceimpl PartialOrd<Content> for Content
impl PartialOrd<Content> for Content
sourcefn partial_cmp(&self, other: &Content) -> Option<Ordering>
fn partial_cmp(&self, other: &Content) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Content
impl StructuralEq for Content
impl StructuralPartialEq for Content
Auto Trait Implementations
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnwindSafe for Content
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more