Skip to content

Commit

Permalink
Change Tag::read_from_path return type to `Result<Box<dyn AudioTag …
Browse files Browse the repository at this point in the history
…+ Send + Sync>>`

closes: TianyiShi2001#8
  • Loading branch information
Serial-ATA committed Aug 1, 2022
1 parent 9a0ffb9 commit 339dcee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions audiotags-dev-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ macro_rules! impl_tag {
}

// From dyn AudioTag to wrapper (any type)
impl From<Box<dyn AudioTag>> for $tag {
fn from(inp: Box<dyn AudioTag>) -> Self {
impl From<Box<dyn AudioTag + Send + Sync>> for $tag {
fn from(inp: Box<dyn AudioTag + Send + Sync>) -> Self {
let mut inp = inp;
if let Some(t_refmut) = inp.to_any_mut().downcast_mut::<$tag>() {
let t = std::mem::replace(t_refmut, $tag::new()); // TODO: can we avoid creating the dummy tag?
Expand All @@ -85,8 +85,8 @@ macro_rules! impl_tag {
}
}
// From dyn AudioTag to inner (any type)
impl std::convert::From<Box<dyn AudioTag>> for $inner {
fn from(inp: Box<dyn AudioTag>) -> Self {
impl std::convert::From<Box<dyn AudioTag + Send + Sync>> for $inner {
fn from(inp: Box<dyn AudioTag + Send + Sync>) -> Self {
let t: $tag = inp.into();
t.into()
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl Tag {
config,
}
}
pub fn read_from_path(&self, path: impl AsRef<Path>) -> crate::Result<Box<dyn AudioTag>> {
pub fn read_from_path(&self, path: impl AsRef<Path>) -> crate::Result<Box<dyn AudioTag + Send + Sync>> {
match self.tag_type.unwrap_or(TagType::try_from_ext(
path.as_ref()
.extension()
Expand Down

0 comments on commit 339dcee

Please sign in to comment.