Add MediaType struct
This commit is contained in:
parent
6c74220458
commit
eebd58f5a6
@ -13,6 +13,8 @@ pub mod users;
|
|||||||
pub mod search;
|
pub mod search;
|
||||||
pub mod fileserv;
|
pub mod fileserv;
|
||||||
pub mod error_template;
|
pub mod error_template;
|
||||||
|
pub mod media_type;
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
|
20
src/media_type.rs
Normal file
20
src/media_type.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
/// Differentiates between different types of media
|
||||||
|
/// Used to display a short text near a corresponging image / title to indicate what type of media it is
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub enum MediaType {
|
||||||
|
Song,
|
||||||
|
Album,
|
||||||
|
Artist,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToString for MediaType {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
match self {
|
||||||
|
MediaType::Song => "Song".to_string(),
|
||||||
|
MediaType::Album => "Album".to_string(),
|
||||||
|
MediaType::Artist => "Artist".to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user