From 2dc75690173ed82f634bff11c8a6db04783c7003 Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Mon, 10 Apr 2023 16:47:13 -0400 Subject: [PATCH] ID3v2: Create `From` impls for `FrameValue` --- src/id3/v2/frame/mod.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/id3/v2/frame/mod.rs b/src/id3/v2/frame/mod.rs index e2266ae9..dde65c1d 100644 --- a/src/id3/v2/frame/mod.rs +++ b/src/id3/v2/frame/mod.rs @@ -217,6 +217,36 @@ impl From for FrameValue { } } +impl From for FrameValue { + fn from(value: ExtendedTextFrame) -> Self { + Self::UserText(value) + } +} + +impl From for FrameValue { + fn from(value: ExtendedUrlFrame) -> Self { + Self::UserURL(value) + } +} + +impl From for FrameValue { + fn from(value: AttachedPictureFrame) -> Self { + Self::Picture(value) + } +} + +impl From for FrameValue { + fn from(value: Popularimeter) -> Self { + Self::Popularimeter(value) + } +} + +impl From for FrameValue { + fn from(value: UniqueFileIdentifierFrame) -> Self { + Self::UniqueFileIdentifier(value) + } +} + impl FrameValue { pub(super) fn as_bytes(&self) -> Result> { Ok(match self {