Struct lofty::Picture[][src]

pub struct Picture {
    pub pic_type: PictureType,
    pub mime_type: MimeType,
    pub description: Option<Cow<'static, str>>,
    pub data: Cow<'static, [u8]>,
}
Expand description

Represents a picture, with its data and mime type.

Fields

pic_type: PictureType

The picture type

mime_type: MimeType

The picture’s mimetype

description: Option<Cow<'static, str>>

The picture’s description

data: Cow<'static, [u8]>

The picture’s actual data

Implementations

impl Picture[src]

pub fn new(
    pic_type: PictureType,
    mime_type: MimeType,
    description: Option<Cow<'static, str>>,
    data: Cow<'static, [u8]>
) -> Self
[src]

Create a new Picture

pub fn as_apic_bytes(&self) -> Vec<u8>[src]

Convert the Picture back to an APIC byte vec:

  • Id3v2 APIC
  • Vorbis METADATA_BLOCK_PICTURE

pub fn from_apic_bytes(bytes: &[u8]) -> Result<Self>[src]

Get a Picture from APIC bytes:

  • Id3v2 APIC
  • Vorbis METADATA_BLOCK_PICTURE

Errors

This function will return Error::InvalidData if at any point it’s unable to parse the data

pub fn as_ape_bytes(&self) -> Vec<u8>[src]

Convert the Picture back to an APEv2 byte vec:

  • APEv2 Cover Art

pub fn from_ape_bytes(key: &str, bytes: &[u8]) -> Result<Self>[src]

Get a Picture from APEv2 bytes:

  • APEv2 Cover Art

Errors

This function will return Error::InvalidData if at any point it’s unable to parse the data

Trait Implementations

impl Clone for Picture[src]

fn clone(&self) -> Picture[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 Picture[src]

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

Formats the value using the given formatter. Read more

impl PartialEq<Picture> for Picture[src]

fn eq(&self, other: &Picture) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Picture) -> bool[src]

This method tests for !=.

impl TryFrom<Data> for Picture[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(inp: Data) -> Result<Self>[src]

Performs the conversion.

impl TryFrom<Picture> for Picture[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(inp: Picture) -> Result<Self>[src]

Performs the conversion.

impl Eq for Picture[src]

impl StructuralEq for Picture[src]

impl StructuralPartialEq for Picture[src]

Auto Trait Implementations

impl RefUnwindSafe for Picture

impl Send for Picture

impl Sync for Picture

impl Unpin for Picture

impl UnwindSafe for Picture

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.