diff --git a/src/id3/v2/tag.rs b/src/id3/v2/tag.rs index b1674159..758fdac4 100644 --- a/src/id3/v2/tag.rs +++ b/src/id3/v2/tag.rs @@ -254,7 +254,7 @@ impl ID3v2Tag { } /// Returns all `USLT` frames - pub fn unsync_text(&self) -> impl Iterator { + pub fn unsync_text(&self) -> impl Iterator + Clone { self.frames.iter().filter_map(|f| match f { Frame { id: FrameID::Valid(id), @@ -266,7 +266,7 @@ impl ID3v2Tag { } /// Returns all `COMM` frames - pub fn comments(&self) -> impl Iterator { + pub fn comments(&self) -> impl Iterator + Clone { self.frames.iter().filter_map(|f| match f { Frame { id: FrameID::Valid(id), @@ -691,7 +691,7 @@ impl<'a> Id3v2TagRef<'a, std::iter::Empty>> { } // Create an iterator of FrameRef from a Tag's items for Id3v2TagRef::new -pub(crate) fn tag_frames(tag: &Tag) -> impl Iterator> + Clone + '_ { +pub(crate) fn tag_frames(tag: &Tag) -> impl Iterator> + Clone { let items = tag .items() .iter() diff --git a/src/iff/wav/tag/mod.rs b/src/iff/wav/tag/mod.rs index dde07227..25d1f8d7 100644 --- a/src/iff/wav/tag/mod.rs +++ b/src/iff/wav/tag/mod.rs @@ -259,7 +259,7 @@ where } } -pub(crate) fn tagitems_into_riff(items: &[TagItem]) -> impl Iterator { +pub(crate) fn tagitems_into_riff(items: &[TagItem]) -> impl Iterator + Clone { items.iter().filter_map(|i| { let item_key = i.key().map_key(TagType::RIFFInfo, true); diff --git a/src/mp4/ilst/mod.rs b/src/mp4/ilst/mod.rs index c661b766..660486a1 100644 --- a/src/mp4/ilst/mod.rs +++ b/src/mp4/ilst/mod.rs @@ -118,7 +118,7 @@ impl Ilst { } /// Returns all pictures - pub fn pictures(&self) -> impl Iterator { + pub fn pictures(&self) -> impl Iterator + Clone { const COVR: AtomIdent<'_> = AtomIdent::Fourcc(*b"covr"); self.atoms.iter().filter_map(|a| match a.ident { diff --git a/src/ogg/tag.rs b/src/ogg/tag.rs index 968673ab..6ab27f93 100644 --- a/src/ogg/tag.rs +++ b/src/ogg/tag.rs @@ -61,9 +61,9 @@ impl VorbisComments { self.vendor = vendor } - /// Returns the tag's items in (key, value) pairs - pub fn items(&self) -> &[(String, String)] { - &self.items + /// Returns an [`Iterator`] over the stored key/value pairs + pub fn items(&self) -> impl Iterator + Clone { + self.items.iter().map(|(k, v)| (k.as_str(), v.as_str())) } /// Gets an item by key @@ -95,7 +95,7 @@ impl VorbisComments { /// let all_artists = vorbis_comments.get_all("ARTIST").collect::>(); /// assert_eq!(all_artists, vec!["Foo artist", "Bar artist", "Baz artist"]); /// ``` - pub fn get_all<'a>(&'a self, key: &'a str) -> impl Iterator + '_ { + pub fn get_all<'a>(&'a self, key: &'a str) -> impl Iterator + Clone + '_ { self.items .iter() .filter_map(move |(k, v)| (k == key).then_some(v.as_str())) diff --git a/src/ogg/vorbis/mod.rs b/src/ogg/vorbis/mod.rs index 414db4e7..df7c0641 100644 --- a/src/ogg/vorbis/mod.rs +++ b/src/ogg/vorbis/mod.rs @@ -15,7 +15,7 @@ use lofty_attr::LoftyFile; #[derive(LoftyFile)] #[lofty(read_fn = "Self::read_from")] pub struct VorbisFile { - /// The vorbis comments contained in the file + /// The Vorbis Comments contained in the file /// /// NOTE: While a metadata packet is required, it isn't required to actually have any data. #[lofty(tag_type = "VorbisComments")] diff --git a/src/tag/mod.rs b/src/tag/mod.rs index cb4c1342..364e2b31 100644 --- a/src/tag/mod.rs +++ b/src/tag/mod.rs @@ -381,12 +381,12 @@ impl Tag { } /// Returns references to all [`TagItem`]s with the specified key - pub fn get_items<'a>(&'a self, key: &'a ItemKey) -> impl Iterator { + pub fn get_items<'a>(&'a self, key: &'a ItemKey) -> impl Iterator + Clone { self.items.iter().filter(move |i| i.key() == key) } /// Returns references to all texts of [`TagItem`]s with the specified key, and [`ItemValue::Text`] - pub fn get_strings<'a>(&'a self, key: &'a ItemKey) -> impl Iterator { + pub fn get_strings<'a>(&'a self, key: &'a ItemKey) -> impl Iterator + Clone { self.items.iter().filter_map(move |i| { if i.key() == key { i.value().text() @@ -397,7 +397,7 @@ impl Tag { } /// Returns references to all locators of [`TagItem`]s with the specified key, and [`ItemValue::Locator`] - pub fn get_locators<'a>(&'a self, key: &'a ItemKey) -> impl Iterator { + pub fn get_locators<'a>(&'a self, key: &'a ItemKey) -> impl Iterator + Clone { self.items.iter().filter_map(move |i| { if i.key() == key { i.value().locator() @@ -408,7 +408,7 @@ impl Tag { } /// Returns references to all bytes of [`TagItem`]s with the specified key, and [`ItemValue::Binary`] - pub fn get_bytes<'a>(&'a self, key: &'a ItemKey) -> impl Iterator { + pub fn get_bytes<'a>(&'a self, key: &'a ItemKey) -> impl Iterator + Clone { self.items.iter().filter_map(move |i| { if i.key() == key { i.value().binary()