Struct FrameFlags

Source
pub struct FrameFlags {
    pub tag_alter_preservation: bool,
    pub file_alter_preservation: bool,
    pub read_only: bool,
    pub grouping_identity: Option<u8>,
    pub compression: bool,
    pub encryption: Option<u8>,
    pub unsynchronisation: bool,
    pub data_length_indicator: Option<u32>,
}
Expand description

Various flags to describe the content of an item

Fields§

§tag_alter_preservation: bool

Preserve frame on tag edit

§file_alter_preservation: bool

Preserve frame on file edit

§read_only: bool

Item cannot be written to

§grouping_identity: Option<u8>

The group identifier the frame belongs to

All frames with the same group identifier byte belong to the same group.

§compression: bool

Frame is zlib compressed

It is required data_length_indicator be set if this is set.

§encryption: Option<u8>

Frame encryption method symbol

NOTE: Since the encryption method is unknown, lofty cannot do anything with these frames

The encryption method symbol must be > 0x80.

§unsynchronisation: bool

Frame is unsynchronised

In short, this makes all “0xFF X (X >= 0xE0)” combinations into “0xFF 0x00 X” to avoid confusion with the MPEG frame header, which is often identified by its “frame sync” (11 set bits). It is preferred an ID3v2 tag is either completely unsynchronised or not unsynchronised at all.

NOTE: While unsynchronized data is read, for the sake of simplicity, this flag has no effect when writing. There isn’t much reason to write unsynchronized data.

§data_length_indicator: Option<u32>

Frame has a data length indicator

The data length indicator is the size of the frame if the flags were all zeroed out. This is usually used in combination with compression and encryption (depending on encryption method).

If using encryption, the final size must be added.

Implementations§

Source§

impl FrameFlags

Source

pub fn parse_id3v24(flags: u16) -> Self

Parse the flags from an ID3v2.4 frame

NOTE: If any of the following flags are set, they will be set to Some(0):

  • grouping_identity
  • encryption
  • data_length_indicator
Source

pub fn parse_id3v23(flags: u16) -> Self

Parse the flags from an ID3v2.3 frame

NOTE: If any of the following flags are set, they will be set to Some(0):

  • grouping_identity
  • encryption
Source

pub fn as_id3v24_bytes(&self) -> u16

Get the ID3v2.4 byte representation of the flags

Source

pub fn as_id3v23_bytes(&self) -> u16

Get the ID3v2.3 byte representation of the flags

Trait Implementations§

Source§

impl Clone for FrameFlags

Source§

fn clone(&self) -> FrameFlags

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FrameFlags

Source§

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

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

impl Default for FrameFlags

Source§

fn default() -> FrameFlags

Returns the “default value” for a type. Read more
Source§

impl Hash for FrameFlags

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 PartialEq for FrameFlags

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for FrameFlags

Source§

impl Eq for FrameFlags

Source§

impl StructuralPartialEq for FrameFlags

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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

Source§

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

Source§

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.