mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
36 lines
826 B
Rust
36 lines
826 B
Rust
|
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<String>,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug, Clone)]
|
||
|
pub struct ContentRatings(pub Vec<ContentRating>);
|
||
|
|
||
|
impl Deref for ContentRatings {
|
||
|
type Target = Vec<ContentRating>;
|
||
|
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);
|