mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-14 06:32:33 +00:00
mp4: Implement IntoIterator for Ilst
This is needed for merging tags.
This commit is contained in:
parent
1c41dfa861
commit
bdf1547afb
1 changed files with 18 additions and 5 deletions
|
@ -83,11 +83,6 @@ pub struct Ilst {
|
|||
}
|
||||
|
||||
impl Ilst {
|
||||
/// Returns all of the tag's atoms
|
||||
pub fn atoms(&self) -> &[Atom<'static>] {
|
||||
&self.atoms
|
||||
}
|
||||
|
||||
/// Get an item by its [`AtomIdent`]
|
||||
pub fn atom(&self, ident: &AtomIdent<'_>) -> Option<&Atom<'static>> {
|
||||
self.atoms.iter().find(|a| &a.ident == ident)
|
||||
|
@ -213,6 +208,24 @@ impl Ilst {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> IntoIterator for &'a Ilst {
|
||||
type Item = &'a Atom<'static>;
|
||||
type IntoIter = std::slice::Iter<'a, Atom<'static>>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.atoms.iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for Ilst {
|
||||
type Item = Atom<'static>;
|
||||
type IntoIter = std::vec::IntoIter<Atom<'static>>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.atoms.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl Accessor for Ilst {
|
||||
impl_accessor!(
|
||||
artist => ARTIST;
|
||||
|
|
Loading…
Reference in a new issue