Struct lofty::TaggedFile

source ·
pub struct TaggedFile { /* private fields */ }
Expand description

A generic representation of a file

This is used when the FileType has to be guessed

Implementations§

source§

impl TaggedFile

source

pub fn change_file_type(&mut self, file_type: FileType)

Changes the FileType

NOTES:

§Examples
use lofty::{AudioFile, FileType, TagType, TaggedFileExt};

// Read an MP3 file containing an ID3v2 tag
let mut tagged_file = lofty::read_from_path(path_to_mp3)?;

assert!(tagged_file.contains_tag_type(TagType::Id3v2));

// Remap our MP3 file to WavPack, which doesn't support ID3v2
tagged_file.change_file_type(FileType::WavPack);

assert!(!tagged_file.contains_tag_type(TagType::Id3v2));

Trait Implementations§

source§

impl AudioFile for TaggedFile

§

type Properties = FileProperties

The struct the file uses for audio properties Read more
source§

fn read_from<R>(reader: &mut R, parse_options: ParseOptions) -> Result<Self>
where R: Read + Seek, Self: Sized,

Read a file from a reader Read more
source§

fn save_to(&self, file: &mut File) -> Result<()>

Attempts to write all tags to a file Read more
source§

fn properties(&self) -> &Self::Properties

Returns a reference to the file’s properties
source§

fn contains_tag(&self) -> bool

Checks if the file contains any tags
source§

fn contains_tag_type(&self, tag_type: TagType) -> bool

Checks if the file contains the given TagType
source§

fn save_to_path(&self, path: impl AsRef<Path>) -> Result<()>

Attempts to write all tags to a path Read more
source§

impl From<AacFile> for TaggedFile

source§

fn from(input: AacFile) -> Self

Converts to this type from the input type.
source§

impl From<AiffFile> for TaggedFile

source§

fn from(input: AiffFile) -> Self

Converts to this type from the input type.
source§

impl From<ApeFile> for TaggedFile

source§

fn from(input: ApeFile) -> Self

Converts to this type from the input type.
source§

impl From<BoundTaggedFile> for TaggedFile

source§

fn from(input: BoundTaggedFile) -> Self

Converts to this type from the input type.
source§

impl From<FlacFile> for TaggedFile

source§

fn from(value: FlacFile) -> Self

Converts to this type from the input type.
source§

impl From<Mp4File> for TaggedFile

source§

fn from(input: Mp4File) -> Self

Converts to this type from the input type.
source§

impl From<MpcFile> for TaggedFile

source§

fn from(input: MpcFile) -> Self

Converts to this type from the input type.
source§

impl From<MpegFile> for TaggedFile

source§

fn from(input: MpegFile) -> Self

Converts to this type from the input type.
source§

impl From<OpusFile> for TaggedFile

source§

fn from(input: OpusFile) -> Self

Converts to this type from the input type.
source§

impl From<SpeexFile> for TaggedFile

source§

fn from(input: SpeexFile) -> Self

Converts to this type from the input type.
source§

impl From<VorbisFile> for TaggedFile

source§

fn from(input: VorbisFile) -> Self

Converts to this type from the input type.
source§

impl From<WavFile> for TaggedFile

source§

fn from(input: WavFile) -> Self

Converts to this type from the input type.
source§

impl From<WavPackFile> for TaggedFile

source§

fn from(input: WavPackFile) -> Self

Converts to this type from the input type.
source§

impl TaggedFileExt for TaggedFile

source§

fn file_type(&self) -> FileType

Returns the file’s FileType Read more
source§

fn tags(&self) -> &[Tag]

Returns all tags Read more
source§

fn tag(&self, tag_type: TagType) -> Option<&Tag>

Get a reference to a specific TagType Read more
source§

fn tag_mut(&mut self, tag_type: TagType) -> Option<&mut Tag>

Get a mutable reference to a specific TagType Read more
source§

fn first_tag_mut(&mut self) -> Option<&mut Tag>

Gets a mutable reference to the first tag, if there are any Read more
source§

fn insert_tag(&mut self, tag: Tag) -> Option<Tag>

Inserts a Tag Read more
source§

fn remove(&mut self, tag_type: TagType) -> Option<Tag>

Removes a specific TagType and returns it Read more
source§

fn clear(&mut self)

Removes all tags from the file Read more
source§

fn primary_tag_type(&self) -> TagType

Returns the file type’s primary TagType Read more
source§

fn supports_tag_type(&self, tag_type: TagType) -> bool

Determines whether the file supports the given TagType Read more
source§

fn primary_tag(&self) -> Option<&Tag>

Returns the primary tag Read more
source§

fn primary_tag_mut(&mut self) -> Option<&mut Tag>

Gets a mutable reference to the file’s “Primary tag” Read more
source§

fn first_tag(&self) -> Option<&Tag>

Gets the first tag, if there are any Read more

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