mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
downcast to wrapper tag
This commit is contained in:
parent
6e10a0b93d
commit
923d7b1ce8
1 changed files with 8 additions and 8 deletions
|
@ -61,14 +61,14 @@ macro_rules! impl_tag {
|
|||
|
||||
// downcasting
|
||||
|
||||
// impl std::convert::TryFrom<Box<dyn AudioTag>> for &$tag {
|
||||
// type Error = crate::Error;
|
||||
// fn try_from(inp: Box<dyn AudioTag>) -> crate::Result<Self> {
|
||||
// inp.into_any()
|
||||
// .downcast_ref::<$tag>()
|
||||
// .ok_or(crate::Error::DowncastError)
|
||||
// }
|
||||
// }
|
||||
impl<'a> std::convert::TryFrom<&'a Box<dyn AudioTag>> for &'a $tag {
|
||||
type Error = crate::Error;
|
||||
fn try_from(inp: &'a Box<dyn AudioTag>) -> crate::Result<Self> {
|
||||
inp.into_any()
|
||||
.downcast_ref::<$tag>()
|
||||
.ok_or(crate::Error::DowncastError)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<Box<dyn AudioTag>> for $inner {
|
||||
type Error = crate::Error;
|
||||
|
|
Loading…
Reference in a new issue