Enum lofty::mp4::AtomData

source ·
pub enum AtomData {
    UTF8(String),
    UTF16(String),
    Picture(Picture),
    SignedInteger(i32),
    UnsignedInteger(u32),
    Bool(bool),
    Unknown {
        code: u32,
        data: Vec<u8>,
    },
}
Expand description

The data of an atom

NOTES:

  • This only covers the most common data types. See the list of well-known data types for codes.
  • There are only two variants for integers, which will come from codes 21 and 22. All other integer types will be stored as AtomData::Unknown, refer to the link above for codes.

Variants§

§

UTF8(String)

A UTF-8 encoded string

§

UTF16(String)

A UTF-16 encoded string

§

Picture(Picture)

A JPEG, PNG, GIF (Deprecated), or BMP image

The type is read from the picture itself

§

SignedInteger(i32)

A big endian signed integer (1-4 bytes)

NOTE:

This will shrink the integer when writing

255 will be written as [255] rather than [0, 0, 0, 255]

This behavior may be unexpected, use AtomData::Unknown if unsure

§

UnsignedInteger(u32)

A big endian unsigned integer (1-4 bytes)

NOTE: See AtomData::SignedInteger

§

Bool(bool)

A boolean value

NOTE: This isn’t an official data type, but multiple flag atoms exist, so this makes them easier to represent. The real underlying type is SignedInteger.

§

Unknown

Unknown data

Due to the number of possible types, there are many specified types that are going to fall into this variant.

Fields

§code: u32

The code, or type of the item

§data: Vec<u8>

The binary data of the atom

Trait Implementations§

source§

impl Clone for AtomData

source§

fn clone(&self) -> AtomData

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 Debug for AtomData

source§

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

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

impl PartialEq for AtomData

source§

fn eq(&self, other: &AtomData) -> 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 Eq for AtomData

source§

impl StructuralPartialEq for AtomData

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> 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,

§

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>,

§

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>,

§

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.