lofty-rs/rtfm/03-anytag.Rmd
2020-10-27 20:26:59 +00:00

16 lines
No EOL
408 B
Text

# `AnyTag`
The following example shows how you can create a "generic" `AnyTag` and convert it into a specific tag type.
```rust
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();
}
```