pub struct Frame { /* private fields */ }
Expand description
A structure representing an ID3 frame.
The Content
must be accompanied by a matching ID. Although this struct allows for invalid
combinations to exist, attempting to encode them will yield an error.
Implementations
sourceimpl Frame
impl Frame
sourcepub fn with_content(id: impl AsRef<str>, content: Content) -> Self
pub fn with_content(id: impl AsRef<str>, content: Content) -> Self
Creates a frame with the specified ID and content.
Both ID3v2.2 and >ID3v2.3 IDs are accepted, although they will be converted to ID3v2.3 format. If an ID3v2.2 ID is supplied but could not be remapped, it is stored as-is.
Panics
If the id’s length is not 3 or 4 bytes long.
sourcepub fn text(id: impl AsRef<str>, content: impl Into<String>) -> Self
pub fn text(id: impl AsRef<str>, content: impl Into<String>) -> Self
Creates a new text frame with the specified ID and text content.
This function does not verify whether the ID is valid for text frames.
Example
use id3::Frame;
let frame = Frame::text("TPE1", "Armin van Buuren");
assert_eq!(frame.content().text(), Some("Armin van Buuren"));
sourcepub fn link(id: impl AsRef<str>, content: impl Into<String>) -> Self
pub fn link(id: impl AsRef<str>, content: impl Into<String>) -> Self
Creates a new link frame with the specified ID and link content.
This function does not verify whether the ID is valid for link frames.
Example
use id3::Frame;
let frame = Frame::link("WCOM", "https://wwww.arminvanbuuren.com");
assert_eq!(frame.content().link(), Some("https://wwww.arminvanbuuren.com"));
sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Returns the ID of this frame.
The string returned us usually 4 bytes long except when the frame was read from an ID3v2.2 tag and the ID could not be mapped to an ID3v2.3 ID.
sourcepub fn id_for_version(&self, version: Version) -> Option<&str>
pub fn id_for_version(&self, version: Version) -> Option<&str>
Returns the ID that is compatible with specified version or None if no ID is available in that version.
sourcepub fn tag_alter_preservation(&self) -> bool
pub fn tag_alter_preservation(&self) -> bool
Returns whether the tag_alter_preservation flag is set.
sourcepub fn set_tag_alter_preservation(&mut self, tag_alter_preservation: bool)
pub fn set_tag_alter_preservation(&mut self, tag_alter_preservation: bool)
Sets the tag_alter_preservation flag.
sourcepub fn file_alter_preservation(&self) -> bool
pub fn file_alter_preservation(&self) -> bool
Returns whether the file_alter_preservation flag is set.
sourcepub fn set_file_alter_preservation(&mut self, file_alter_preservation: bool)
pub fn set_file_alter_preservation(&mut self, file_alter_preservation: bool)
Sets the file_alter_preservation flag.
Trait Implementations
sourceimpl Extend<Frame> for Chapter
impl Extend<Frame> for Chapter
sourcefn extend<I: IntoIterator<Item = Frame>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Frame>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl Extend<Frame> for Tag
impl Extend<Frame> for Tag
sourcefn extend<I: IntoIterator<Item = Frame>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Frame>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl From<EncapsulatedObject> for Frame
impl From<EncapsulatedObject> for Frame
sourcefn from(c: EncapsulatedObject) -> Self
fn from(c: EncapsulatedObject) -> Self
Converts to this type from the input type.
sourceimpl From<ExtendedLink> for Frame
impl From<ExtendedLink> for Frame
sourcefn from(c: ExtendedLink) -> Self
fn from(c: ExtendedLink) -> Self
Converts to this type from the input type.
sourceimpl From<ExtendedText> for Frame
impl From<ExtendedText> for Frame
sourcefn from(c: ExtendedText) -> Self
fn from(c: ExtendedText) -> Self
Converts to this type from the input type.
sourceimpl From<MpegLocationLookupTable> for Frame
impl From<MpegLocationLookupTable> for Frame
sourcefn from(c: MpegLocationLookupTable) -> Self
fn from(c: MpegLocationLookupTable) -> Self
Converts to this type from the input type.
sourceimpl From<Popularimeter> for Frame
impl From<Popularimeter> for Frame
sourcefn from(c: Popularimeter) -> Self
fn from(c: Popularimeter) -> Self
Converts to this type from the input type.
sourceimpl From<SynchronisedLyrics> for Frame
impl From<SynchronisedLyrics> for Frame
sourcefn from(c: SynchronisedLyrics) -> Self
fn from(c: SynchronisedLyrics) -> Self
Converts to this type from the input type.
sourceimpl FromIterator<Frame> for Tag
impl FromIterator<Frame> for Tag
sourcefn from_iter<I: IntoIterator<Item = Frame>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Frame>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl Ord for Frame
impl Ord for Frame
sourceimpl PartialOrd<Frame> for Frame
impl PartialOrd<Frame> for Frame
sourcefn partial_cmp(&self, other: &Frame) -> Option<Ordering>
fn partial_cmp(&self, other: &Frame) -> 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 Frame
impl StructuralEq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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