Add MediaType struct

This commit is contained in:
Ethan Girouard 2024-05-11 12:53:57 -04:00
parent 6c74220458
commit eebd58f5a6
Signed by: eta357
GPG Key ID: 7BCDC36DFD11C146
2 changed files with 22 additions and 0 deletions

View File

@ -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
View 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(),
}
}
}