mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-03-04 14:57:17 +00:00
Remove user-provided Cows for Picture::new
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
9fe7f6dbef
commit
72e361a097
3 changed files with 6 additions and 10 deletions
|
@ -228,11 +228,7 @@ impl AudioTagEdit for Mp4Tag {
|
|||
}
|
||||
}
|
||||
|
||||
if pictures.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(Cow::from(pictures))
|
||||
}
|
||||
(!(pictures.is_empty())).then(|| Cow::from(pictures))
|
||||
}
|
||||
fn set_pictures(&mut self, pictures: Vec<Picture>) {
|
||||
self.remove_pictures();
|
||||
|
|
|
@ -87,7 +87,7 @@ pub trait AudioTagEdit {
|
|||
/// Removes the front cover
|
||||
fn remove_back_cover(&mut self) {}
|
||||
|
||||
/// Returns an `Iterator` over all pictures stored in the track
|
||||
/// Returns all pictures stored in the track, or `None` if empty
|
||||
fn pictures(&self) -> Option<Cow<'static, [Picture]>> {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -306,14 +306,14 @@ impl Picture {
|
|||
pub fn new(
|
||||
pic_type: PictureType,
|
||||
mime_type: MimeType,
|
||||
description: Option<Cow<'static, str>>,
|
||||
data: Cow<'static, [u8]>,
|
||||
description: Option<String>,
|
||||
data: Vec<u8>,
|
||||
) -> Self {
|
||||
Self {
|
||||
pic_type,
|
||||
mime_type,
|
||||
description,
|
||||
data,
|
||||
description: description.map(Cow::from),
|
||||
data: Cow::from(data),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue