Skip to content

Commit

Permalink
Merge pull request #176 from hasezoey/settingsDebug
Browse files Browse the repository at this point in the history
refactor(lib::config): derive "Debug" for "Settings" (and all lower structs)
  • Loading branch information
tramhao authored Nov 25, 2023
2 parents 805ed39 + 4f2f84a commit 1009a89
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions lib/src/config/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub const CONTROL_ALT_SHIFT: KeyModifiers = KeyModifiers::from_bits_truncate(
KeyModifiers::ALT.bits() | KeyModifiers::CONTROL.bits() | KeyModifiers::SHIFT.bits(),
);

#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Deserialize, Serialize, Debug)]
pub struct Keys {
pub global_esc: BindingForEvent,
pub global_quit: BindingForEvent,
Expand Down Expand Up @@ -184,7 +184,7 @@ impl Keys {
}
}

#[derive(Clone, Deserialize, Copy, Eq, PartialEq, Hash, Serialize)]
#[derive(Clone, Deserialize, Copy, Eq, PartialEq, Hash, Serialize, Debug)]
pub struct BindingForEvent {
pub code: Key,
pub modifier: KeyModifiers,
Expand Down
12 changes: 6 additions & 6 deletions lib/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ lazy_static! {
};
}

#[derive(Clone, Copy, Default, Deserialize, Serialize)]
#[derive(Clone, Copy, Default, Deserialize, Serialize, Debug)]
pub enum Loop {
Single,
#[default]
Expand All @@ -87,7 +87,7 @@ impl Loop {
}
}

#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Deserialize, Serialize, Debug)]
pub struct Xywh {
pub x_between_1_100: u32,
pub y_between_1_100: u32,
Expand All @@ -103,7 +103,7 @@ pub struct Xywh {
pub align: Alignment,
}

#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Deserialize, Serialize, Debug)]
pub enum Alignment {
BottomRight,
BottomLeft,
Expand Down Expand Up @@ -240,7 +240,7 @@ impl Xywh {
}
}

#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub enum SeekStep {
Short,
Long,
Expand All @@ -258,7 +258,7 @@ impl std::fmt::Display for SeekStep {
}
}

#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub enum LastPosition {
Yes,
No,
Expand All @@ -276,7 +276,7 @@ impl std::fmt::Display for LastPosition {
}
}

#[derive(Clone, Deserialize, Serialize)]
#[derive(Clone, Deserialize, Serialize, Debug)]
#[allow(clippy::struct_excessive_bools)]
pub struct Settings {
pub music_dir: Vec<String>,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/config/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::PathBuf;
use tuirealm::props::Color;
use yaml_rust::YamlLoader;

#[derive(Copy, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[derive(Copy, Clone, Deserialize, Serialize, PartialEq, Eq, Debug)]
pub enum ColorTermusic {
Reset,
Foreground,
Expand Down Expand Up @@ -110,7 +110,7 @@ impl ColorTermusic {
}
}

#[derive(Clone, Deserialize, Serialize, PartialEq, Eq)]
#[derive(Clone, Deserialize, Serialize, PartialEq, Eq, Debug)]
pub struct StyleColorSymbol {
pub library_foreground: ColorTermusic,
pub library_background: ColorTermusic,
Expand Down Expand Up @@ -201,7 +201,7 @@ impl StyleColorSymbol {
}
}

#[derive(Clone, Deserialize, Serialize, PartialEq, Eq)]
#[derive(Clone, Deserialize, Serialize, PartialEq, Eq, Debug)]
pub struct Alacritty {
pub path: String,
name: String,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/invidious.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const INVIDIOUS_INSTANCE_LIST: [&str; 7] = [

const INVIDIOUS_DOMAINS: &str = "https://api.invidious.io/instances.json?sort_by=type,users";

#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Instance {
pub domain: Option<String>,
client: Client,
Expand All @@ -67,7 +67,7 @@ impl PartialEq for Instance {

impl Eq for Instance {}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct YoutubeVideo {
pub title: String,
pub length_seconds: u64,
Expand Down
14 changes: 7 additions & 7 deletions lib/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::songtag::SongTag;
use anyhow::{anyhow, Result};
use image::DynamicImage;

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum Msg {
// AppClose,
ConfigEditor(ConfigEditorMsg),
Expand Down Expand Up @@ -51,7 +51,7 @@ pub enum Msg {
None,
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum XYWHMsg {
Hide,
MoveLeft,
Expand All @@ -62,7 +62,7 @@ pub enum XYWHMsg {
ZoomOut,
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum DLMsg {
DownloadRunning(String, String), // indicates progress
DownloadSuccess(String),
Expand All @@ -77,13 +77,13 @@ pub enum DLMsg {
FetchPhotoErr(String),
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum LyricMsg {
LyricTextAreaBlurUp,
LyricTextAreaBlurDown,
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum ConfigEditorMsg {
PodcastDirBlurDown,
PodcastDirBlurUp,
Expand Down Expand Up @@ -598,13 +598,13 @@ pub enum SearchLyricState {
Finish(Vec<SongTag>),
}

#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Debug)]
pub struct ImageWrapper {
pub data: DynamicImage,
}
impl Eq for ImageWrapper {}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct YoutubeOptions {
pub items: Vec<YoutubeVideo>,
pub page: u32,
Expand Down
4 changes: 2 additions & 2 deletions playback/src/playlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use termusiclib::{
utils::{filetype_supported, get_app_config_path, get_parent_folder},
};

#[derive(Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub enum Status {
#[default]
Stopped,
Expand Down Expand Up @@ -55,7 +55,7 @@ impl std::fmt::Display for Status {
}
}

#[derive(Default)]
#[derive(Default, Debug)]
pub struct Playlist {
tracks: Vec<Track>,
current_track_index: usize,
Expand Down

0 comments on commit 1009a89

Please sign in to comment.