Skip to content

Commit 8a389c4

Browse files
hinto-janaiSerial-ATA
authored andcommitted
picture: add into_data()
1 parent 1893308 commit 8a389c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/picture.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,16 @@ impl Picture {
535535
self.description = description.map(Cow::from);
536536
}
537537

538-
/// Returns the picture data
538+
/// Returns the [`Picture`] data as borrowed bytes.
539539
pub fn data(&self) -> &[u8] {
540540
&self.data
541541
}
542542

543+
/// Consumes a [`Picture`], returning the data as [`Vec`] without clones or allocation.
544+
pub fn into_data(self) -> Vec<u8> {
545+
self.data.into_owned()
546+
}
547+
543548
/// Convert a [`Picture`] to a ID3v2 A/PIC byte Vec
544549
///
545550
/// NOTE: This does not include the frame header

0 commit comments

Comments
 (0)