docserver/src/defs/req_settings.rs

35 lines
1.1 KiB
Rust
Raw Normal View History

2023-07-19 04:00:41 +01:00
use serde::{Serialize, Deserialize, Deserializer};
use std::collections::HashMap;
fn default_config_resource() -> String {
String::from("")
}
fn default_sitewith() -> Vec<String> {
Vec::new()
}
fn default_config_tpls() -> HashMap<String,String> {
HashMap::new()
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct ReqSettings {
pub name: String,
pub author: String,
pub fullname: String,
pub desc: String,
#[serde(default = "default_config_resource")]
pub url: String,
#[serde(default = "default_config_resource")]
pub trace_url: String,
#[serde(default = "default_config_resource")]
pub title: String,
#[serde(default = "default_config_resource")]
pub subtitle: String,
#[serde(default = "default_config_resource")]
pub pagetitle: String,
#[serde(default = "default_config_tpls")]
pub tpls: HashMap<String,String>,
#[serde(default = "default_config_resource")]
pub sid: String,
#[serde(default = "default_sitewith")]
pub sitewith: Vec<String>,
}