Struct id3::frame::Frame
[−]
[src]
pub struct Frame { /* fields omitted */ }A structure representing an ID3 frame.
It is imporant to note that the (Partial)Eq and Hash implementations are based on the ID3 spec. This means that text frames with equal ID's are equal but picture frames with both "APIC" as ID are not because their uniqueness is also defined by their content.
Methods
impl Frame[src]
fn new<T: Into<String>>(id: T) -> Frame[src]
: Use with_content
Creates a new ID3v2.3 frame with the specified identifier.
Panics
If the id's length is not 3 or 4 bytes long or not known.
fn with_content(id: &str, content: Content) -> Frame[src]
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.
fn id(&self) -> &str[src]
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.
fn id_for_version(&self, version: Version) -> Option<&str>[src]
Returns the ID that is compatible with specified version or None if no ID is available in that version.
fn content(&self) -> &Content[src]
Returns the content of the frame.
fn tag_alter_preservation(&self) -> bool[src]
Returns whether the tag_alter_preservation flag is set.
fn set_tag_alter_preservation(&mut self, tag_alter_preservation: bool)[src]
Sets the tag_alter_preservation flag.
fn file_alter_preservation(&self) -> bool[src]
Returns whether the file_alter_preservation flag is set.
fn set_file_alter_preservation(&mut self, file_alter_preservation: bool)[src]
Sets the file_alter_preservation flag.
fn text(&self) -> Option<Cow<str>>[src]
: Format using fmt::Display
Returns a string representing the parsed content.
Returns None if the parsed content can not be represented as text.
Example
use id3::frame::{self, Frame, Content}; let title_frame = Frame::with_content("TIT2", Content::Text("title".to_owned())); assert_eq!(&title_frame.text().unwrap()[..], "title"); let mut txxx_frame = Frame::with_content("TXXX", Content::ExtendedText(frame::ExtendedText { description: "description".to_owned(), value: "value".to_owned() })); assert_eq!(&txxx_frame.text().unwrap()[..], "description: value");
Trait Implementations
impl Clone for Frame[src]
fn clone(&self) -> Frame[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for Frame[src]
impl Eq for Frame[src]
impl PartialEq for Frame[src]
fn eq(&self, other: &Frame) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl Hash for Frame[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher, [src]
H: Hasher,
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more