monorepo/gm-control-panel/src/config.rs

41 lines
956 B
Rust
Raw Normal View History

2023-08-18 03:48:34 +00:00
use config::define_config;
use config_derive::ConfigOption;
use serde::{Deserialize, Serialize};
2023-08-18 03:48:34 +00:00
use std::path::PathBuf;
2023-08-18 03:48:34 +00:00
define_config! {
Language(Language),
MusicPath(MusicPath),
PlaylistDatabasePath(PlaylistDatabasePath),
}
2023-08-18 03:48:34 +00:00
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ConfigOption)]
pub struct Language(String);
2023-08-18 03:48:34 +00:00
impl std::ops::Deref for Language {
type Target = String;
fn deref(&self) -> &Self::Target {
&self.0
}
}
2023-08-18 03:48:34 +00:00
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ConfigOption)]
pub struct MusicPath(PathBuf);
2023-08-18 03:48:34 +00:00
impl std::ops::Deref for MusicPath {
type Target = PathBuf;
fn deref(&self) -> &Self::Target {
&self.0
}
}
2023-08-18 03:48:34 +00:00
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ConfigOption)]
pub struct PlaylistDatabasePath(PathBuf);
2023-08-18 03:48:34 +00:00
impl std::ops::Deref for PlaylistDatabasePath {
type Target = PathBuf;
fn deref(&self) -> &Self::Target {
&self.0
}
}