Skip to content

Retain format-specific tag items in conversion to Tag #302

Closed

Description

@Serial-ATA

Since we know all of the tag types ahead of time, there's no reason we couldn't preserve the format-specific items (or the entire tag itself) in an immutable way inside the Tag, using an enum.

  • This would be a global setting, like allocation_limit, which would be enabled by default.
  • On any call to Tag::re_map(), the format-specific items would be discarded.
  • On Tag::save_to, the format-specific write implementation would simply chain the items to the iterator, for example:
    pub(crate) fn tag_frames(tag: &Tag) -> impl Iterator<Item = FrameRef<'_>> + Clone {

This would make #288 obsolete, and save users from metadata loss, due to the majority simply using the generic API for reads and writes.

This would not affect {split, merge}_tag. It will only be used for Into::<Tag>::into(format_specific_tag), for example:

lofty-rs/src/id3/v2/tag.rs

Lines 1285 to 1289 in be749a4

impl From<Id3v2Tag> for Tag {
fn from(input: Id3v2Tag) -> Self {
input.split_tag().1
}
}

Not sure of this now, but this could also remove the need for ItemKey::Unknown, allowing it to finally be Copy. This has been a pain point forever.

Activity

  1. added
    enhancement
    on Dec 18, 2023
  2. added this to the 0.19.0 milestone on Jan 3, 2024
  3. modified the milestones: 0.19.0, 0.20.0 on Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions