mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-14 06:32:33 +00:00
ogg: Add a consuming iterator over all items
This commit is contained in:
parent
751f5ca06f
commit
07606159ec
1 changed files with 12 additions and 2 deletions
|
@ -61,11 +61,21 @@ impl VorbisComments {
|
|||
self.vendor = vendor
|
||||
}
|
||||
|
||||
/// Returns an [`Iterator`] over the stored key/value pairs
|
||||
pub fn items(&self) -> impl Iterator<Item = (&str, &str)> + Clone {
|
||||
/// Visit all items
|
||||
///
|
||||
/// Returns an [`Iterator`] over the stored key/value pairs.
|
||||
pub fn items(&self) -> impl ExactSizeIterator<Item = (&str, &str)> + 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<Item = (String, String)> {
|
||||
let items = std::mem::take(&mut self.items);
|
||||
items.into_iter()
|
||||
}
|
||||
|
||||
/// Gets an item by key
|
||||
///
|
||||
/// NOTE: This is case-sensitive
|
||||
|
|
Loading…
Reference in a new issue