mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-03-04 14:57:17 +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();
|
let id3tag_reload = Tag::default().read_from_path("assets/a.mp3").unwrap();
|
||||||
assert_eq!(id3tag_reload.title(), Some("title from metaflac::Tag"));
|
assert_eq!(id3tag_reload.title(), Some("title from metaflac::Tag"));
|
||||||
|
|
||||||
let mut id3tag_inner: id3::Tag = id3tag_reload
|
// let mut id3tag_inner: id3::Tag = id3tag_reload
|
||||||
.into_any()
|
// .into_any()
|
||||||
.downcast_ref::<Id3v2Tag>()
|
// .downcast_ref::<Id3v2Tag>()
|
||||||
.unwrap()
|
// .unwrap()
|
||||||
.into();
|
// .into();
|
||||||
|
let mut id3tag_inner: id3::Tag = downcast!(id3tag_reload, Id3v2Tag);
|
||||||
let timestamp = id3::Timestamp {
|
let timestamp = id3::Timestamp {
|
||||||
year: 2013,
|
year: 2013,
|
||||||
month: Some(2u8),
|
month: Some(2u8),
|
||||||
|
|
Loading…
Add table
Reference in a new issue