Reorder structs

This commit is contained in:
Joscha 2023-08-08 23:42:45 +02:00
parent cee838d0e9
commit afb7a94348

View file

@ -10,6 +10,10 @@ use crate::somehow;
mod default { mod default {
use std::time::Duration; use std::time::Duration;
pub fn web_base() -> String {
"".to_string()
}
pub fn repo_name() -> String { pub fn repo_name() -> String {
"local repo".to_string() "local repo".to_string()
} }
@ -17,9 +21,19 @@ mod default {
pub fn repo_update_delay() -> Duration { pub fn repo_update_delay() -> Duration {
Duration::from_secs(60) Duration::from_secs(60)
} }
}
pub fn web_base() -> String { #[derive(Debug, Deserialize)]
"".to_string() pub struct Web {
#[serde(default = "default::web_base")]
pub base: String,
}
impl Default for Web {
fn default() -> Self {
Self {
base: default::web_base(),
}
} }
} }
@ -40,20 +54,6 @@ impl Default for Repo {
} }
} }
#[derive(Debug, Deserialize)]
pub struct Web {
#[serde(default = "default::web_base")]
pub base: String,
}
impl Default for Web {
fn default() -> Self {
Self {
base: default::web_base(),
}
}
}
#[derive(Debug, Default, Deserialize)] #[derive(Debug, Default, Deserialize)]
struct ConfigFile { struct ConfigFile {
repo: Repo, repo: Repo,