librespot_metadata/
copyright.rs1use std::{
2 fmt::Debug,
3 ops::{Deref, DerefMut},
4};
5
6use crate::util::{impl_deref_wrapped, impl_from_repeated};
7
8use librespot_protocol as protocol;
9use protocol::metadata::Copyright as CopyrightMessage;
10pub use protocol::metadata::copyright::Type as CopyrightType;
11
12#[derive(Debug, Clone)]
13pub struct Copyright {
14 pub copyright_type: CopyrightType,
15 pub text: String,
16}
17
18#[derive(Debug, Clone, Default)]
19pub struct Copyrights(pub Vec<Copyright>);
20
21impl_deref_wrapped!(Copyrights, Vec<Copyright>);
22
23impl From<&CopyrightMessage> for Copyright {
24 fn from(copyright: &CopyrightMessage) -> Self {
25 Self {
26 copyright_type: copyright.type_(),
27 text: copyright.text().to_owned(),
28 }
29 }
30}
31
32impl_from_repeated!(CopyrightMessage, Copyrights);