use std::fmt::Debug; use std::ops::Deref; use crate::util::from_repeated_message; use librespot_protocol as protocol; use protocol::metadata::ContentRating as ContentRatingMessage; #[derive(Debug, Clone)] pub struct ContentRating { pub country: String, pub tags: Vec, } #[derive(Debug, Clone)] pub struct ContentRatings(pub Vec); impl Deref for ContentRatings { type Target = Vec; fn deref(&self) -> &Self::Target { &self.0 } } impl From<&ContentRatingMessage> for ContentRating { fn from(content_rating: &ContentRatingMessage) -> Self { Self { country: content_rating.get_country().to_owned(), tags: content_rating.get_tag().to_vec(), } } } from_repeated_message!(ContentRatingMessage, ContentRatings);