From cff5d8fc6b8bcf69bebd2993e41df62851918fd4 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Sun, 15 Jan 2023 11:44:25 +0100 Subject: [PATCH] id3v2: Retain frames by predicate --- src/id3/v2/tag.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/id3/v2/tag.rs b/src/id3/v2/tag.rs index d402ae6b..9e3bb5eb 100644 --- a/src/id3/v2/tag.rs +++ b/src/id3/v2/tag.rs @@ -190,6 +190,14 @@ impl ID3v2Tag { self.frames.retain(|f| f.id_str() != id) } + /// Retains [`Frame`]s by evaluating the predicate + pub fn retain

(&mut self, predicate: P) + where + P: FnMut(&Frame<'_>) -> bool, + { + self.frames.retain(predicate) + } + /// Inserts a [`Picture`] /// /// According to spec, there can only be one picture of type [`PictureType::Icon`] and [`PictureType::OtherIcon`].