Struct lofty::id3::v2::Frame

source ·
pub struct Frame<'a> { /* private fields */ }
Expand description

Represents an ID3v2 frame

Outdated Frames

ID3v2.2

ID3v2.2 frame IDs are 3 characters. When reading these tags, upgrade_v2 is used, which has a list of all of the common IDs that have a mapping to ID3v2.4. Any ID that fails to be converted will be stored as FrameId::Outdated, and it must be manually upgraded before it can be written. Lofty will not write ID3v2.2 tags.

ID3v2.3

ID3v2.3, unlike ID3v2.2, stores frame IDs in 4 characters like ID3v2.4. There are some IDs that need upgrading (See upgrade_v3), but anything that fails to be upgraded will not be stored as FrameId::Outdated, as it is likely not an issue to write.

Implementations§

source§

impl<'a> Frame<'a>

source

pub fn new<I, V>(id: I, value: V, flags: FrameFlags) -> Result<Self>where I: Into<Cow<'a, str>>, V: Into<FrameValue>,

Create a new frame

NOTE: This will accept both ID3v2.2 and ID3v2.3/4 frame IDs

Errors
  • id is less than 3 or greater than 4 bytes
  • id contains non-ascii characters
source

pub fn id_str(&self) -> &str

Extract the string from the FrameId

source

pub fn content(&self) -> &FrameValue

Returns the frame’s content

source

pub fn flags(&self) -> &FrameFlags

Returns a reference to the FrameFlags

source

pub fn set_flags(&mut self, flags: FrameFlags)

Set the item’s flags

Trait Implementations§

source§

impl<'a> Clone for Frame<'a>

source§

fn clone(&self) -> Frame<'a>

Returns a copy 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 Frame<'a>

source§

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

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

impl<'a> Hash for Frame<'a>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> PartialEq for Frame<'a>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for Frame<'a>

source§

impl<'a> StructuralEq for Frame<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Frame<'a>

§

impl<'a> Send for Frame<'a>

§

impl<'a> Sync for Frame<'a>

§

impl<'a> Unpin for Frame<'a>

§

impl<'a> UnwindSafe for Frame<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.