pub struct ID3v1Tag {
    pub title: Option<String>,
    pub artist: Option<String>,
    pub album: Option<String>,
    pub year: Option<String>,
    pub comment: Option<String>,
    pub track_number: Option<u8>,
    pub genre: Option<u8>,
}
Expand description

An ID3v1 tag

ID3v1 is a severely limited format, with each field being incredibly small in size. All fields have been commented with their maximum sizes and any other additional restrictions.

Attempting to write a field greater than the maximum size will not error, it will just be shrunk.

Supported file types

Conversions

From Tag

Two checks are performed when converting a genre:

Fields

title: Option<String>

Track title, 30 bytes max

artist: Option<String>

Track artist, 30 bytes max

album: Option<String>

Album title, 30 bytes max

year: Option<String>

Release year, 4 bytes max

comment: Option<String>

A short comment

The number of bytes differs between versions, but not much. A V1 tag may have been read, which limits this field to 30 bytes. A V1.1 tag, however, only has 28 bytes available.

Lofty will always write a V1.1 tag.

track_number: Option<u8>

The track number, 1 byte max

Issues:

  • The track number cannot be 0. Many readers, including Lofty, look for a null byte at the end of the comment to differentiate between V1 and V1.1.
  • A V1 tag may have been read, which does not have a track number.
genre: Option<u8>

The track’s genre, 1 byte max

ID3v1 has a predefined set of genres, see GENRES. This byte should be an index to a genre.

Trait Implementations

Returns the title Read more

Sets the title Read more

Removes the title Read more

Returns the artist Read more

Sets the artist Read more

Removes the artist Read more

Returns the album Read more

Sets the album Read more

Removes the album Read more

Returns the genre Read more

Sets the genre Read more

Removes the genre Read more

Returns the track Read more

Sets the track Read more

Removes the track Read more

Returns the comment Read more

Sets the comment Read more

Removes the comment Read more

Returns the year Read more

Sets the year Read more

Removes the year Read more

Returns the track total Read more

Sets the track total Read more

Removes the track total Read more

Returns the disk Read more

Sets the disk Read more

Removes the disk Read more

Returns the disk total Read more

Sets the disk total Read more

Removes the disk total Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Converts to this type from the input type.

Converts to this type from the input type.

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

This method tests for !=.

Dumps the tag to a writer

Errors

The associated error which can be returned from IO operations

Whether the tag has any items Read more

Save the tag to a path Read more

Save the tag to a File Read more

Remove a tag from a Path Read more

Remove a tag from a File Read more

Clear the tag, removing all items Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.