mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-14 06:32:33 +00:00
16 lines
No EOL
408 B
Text
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();
|
|
}
|
|
``` |