3 AnyTag

The following example shows how you can create a “generic” AnyTag and convert it into a specific tag type.

use audiotags::{AnyTag, AudioTagEdit, Id3v2Tag};

fn main() {
    let mut tag = AnyTag::default();
    tag.set_title("foo");
    tag.set_year(2001);
    let tag: Id3v2Tag = tag.into();
    assert_eq!(tag.year(), Some(2001));
    tag.write_to_path("assets/a.mp3").unwrap();
}