From 12c00a1c79dd77390f7258563fdb573554a82352 Mon Sep 17 00:00:00 2001 From: Remigiusz Micielski Date: Mon, 8 Jul 2024 20:14:41 +0200 Subject: [PATCH] fix: allow not specifying headers in torrents tab config --- rm-config/src/main_config.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/rm-config/src/main_config.rs b/rm-config/src/main_config.rs index 50f85fe..ba9f63b 100644 --- a/rm-config/src/main_config.rs +++ b/rm-config/src/main_config.rs @@ -115,20 +115,25 @@ impl Header { #[derive(Deserialize)] pub struct TorrentsTab { + #[serde(default = "default_headers")] pub headers: Vec
, } +fn default_headers() -> Vec
{ + vec![ + Header::Name, + Header::SizeWhenDone, + Header::Progress, + Header::Eta, + Header::DownloadRate, + Header::UploadRate, + ] +} + impl Default for TorrentsTab { fn default() -> Self { Self { - headers: vec![ - Header::Name, - Header::SizeWhenDone, - Header::Progress, - Header::Eta, - Header::DownloadRate, - Header::UploadRate, - ], + headers: default_headers(), } } }