Implement Into<DashboardTile> instead of implementing old trait DashboardTile
This commit is contained in:
@ -23,20 +23,13 @@ pub struct AlbumData {
|
||||
pub image_path: String,
|
||||
}
|
||||
|
||||
impl DashboardTile for AlbumData {
|
||||
fn image_path(&self) -> String {
|
||||
self.image_path.clone()
|
||||
impl Into<DashboardTile> for AlbumData {
|
||||
fn into(self) -> DashboardTile {
|
||||
DashboardTile {
|
||||
image_path: self.image_path.into(),
|
||||
title: self.title.into(),
|
||||
link: format!("/album/{}", self.id).into(),
|
||||
description: Some(format!("Album • {}", Artist::display_list(&self.artists)).into()),
|
||||
}
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
}
|
||||
|
||||
fn link(&self) -> String {
|
||||
format!("/album/{}", self.id)
|
||||
}
|
||||
|
||||
fn description(&self) -> Option<String> {
|
||||
Some(format!("Album • {}", Artist::display_list(&self.artists)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,20 +15,13 @@ pub struct ArtistData {
|
||||
pub image_path: String,
|
||||
}
|
||||
|
||||
impl DashboardTile for ArtistData {
|
||||
fn image_path(&self) -> String {
|
||||
self.image_path.clone()
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn link(&self) -> String {
|
||||
format!("/artist/{}", self.id)
|
||||
}
|
||||
|
||||
fn description(&self) -> Option<String> {
|
||||
Some("Artist".to_string())
|
||||
impl Into<DashboardTile> for ArtistData {
|
||||
fn into(self) -> DashboardTile {
|
||||
DashboardTile {
|
||||
image_path: self.image_path.into(),
|
||||
title: self.name.into(),
|
||||
link: format!("/artist/{}", self.id).into(),
|
||||
description: Some("Artist".into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,20 +67,13 @@ impl TryInto<Song> for SongData {
|
||||
}
|
||||
}
|
||||
|
||||
impl DashboardTile for SongData {
|
||||
fn image_path(&self) -> String {
|
||||
self.image_path.clone()
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
self.title.clone()
|
||||
}
|
||||
|
||||
fn link(&self) -> String {
|
||||
format!("/song/{}", self.id)
|
||||
}
|
||||
|
||||
fn description(&self) -> Option<String> {
|
||||
Some(format!("Song • {}", Artist::display_list(&self.artists)))
|
||||
impl Into<DashboardTile> for SongData {
|
||||
fn into(self) -> DashboardTile {
|
||||
DashboardTile {
|
||||
image_path: self.image_path.into(),
|
||||
title: self.title.into(),
|
||||
link: format!("/song/{}", self.id).into(),
|
||||
description: Some(format!("Song • {}", Artist::display_list(&self.artists)).into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user