diff --git a/src/ogg/tag.rs b/src/ogg/tag.rs index 6ab27f93..ce138463 100644 --- a/src/ogg/tag.rs +++ b/src/ogg/tag.rs @@ -61,11 +61,21 @@ impl VorbisComments { self.vendor = vendor } - /// Returns an [`Iterator`] over the stored key/value pairs - pub fn items(&self) -> impl Iterator + Clone { + /// Visit all items + /// + /// Returns an [`Iterator`] over the stored key/value pairs. + pub fn items(&self) -> impl ExactSizeIterator + Clone { self.items.iter().map(|(k, v)| (k.as_str(), v.as_str())) } + /// Consume all items + /// + /// Returns an [`Iterator`] with the stored key/value pairs. + pub fn take_items(&mut self) -> impl ExactSizeIterator { + let items = std::mem::take(&mut self.items); + items.into_iter() + } + /// Gets an item by key /// /// NOTE: This is case-sensitive