mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-12 21:52:33 +00:00
black magic
This commit is contained in:
parent
47ae10071a
commit
fececf76e9
3 changed files with 13 additions and 5 deletions
BIN
assets/a.mp3
BIN
assets/a.mp3
Binary file not shown.
|
@ -144,3 +144,10 @@ impl Tag {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! downcast {
|
||||
($tag:expr, $type:ty) => {
|
||||
$tag.into_any().downcast_ref::<$type>().unwrap().into()
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,11 +13,12 @@ fn test_inner() {
|
|||
let id3tag_reload = Tag::default().read_from_path("assets/a.mp3").unwrap();
|
||||
assert_eq!(id3tag_reload.title(), Some("title from metaflac::Tag"));
|
||||
|
||||
let mut id3tag_inner: id3::Tag = id3tag_reload
|
||||
.into_any()
|
||||
.downcast_ref::<Id3v2Tag>()
|
||||
.unwrap()
|
||||
.into();
|
||||
// let mut id3tag_inner: id3::Tag = id3tag_reload
|
||||
// .into_any()
|
||||
// .downcast_ref::<Id3v2Tag>()
|
||||
// .unwrap()
|
||||
// .into();
|
||||
let mut id3tag_inner: id3::Tag = downcast!(id3tag_reload, Id3v2Tag);
|
||||
let timestamp = id3::Timestamp {
|
||||
year: 2013,
|
||||
month: Some(2u8),
|
||||
|
|
Loading…
Reference in a new issue