mirror of
https://gitea.tendokyu.moe/beerpsi/icf-reader.git
synced 2026-10-12 09:18:11 +03:00
fix: give unneeded fields default values
convenient when composing an json:icf file by hand
This commit is contained in:
@@ -26,14 +26,20 @@ pub struct IcfInnerData {
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct IcfOptionData {
|
||||
#[serde(default = "empty_string")]
|
||||
pub app_id: String,
|
||||
|
||||
pub option_id: String,
|
||||
|
||||
#[serde(default = "empty_version")]
|
||||
pub required_system_version: Version,
|
||||
|
||||
pub datetime: NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct IcfPatchData {
|
||||
#[serde(default = "empty_string")]
|
||||
pub id: String,
|
||||
|
||||
pub sequence_number: u8,
|
||||
@@ -90,3 +96,11 @@ impl IcfData {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn empty_string() -> String {
|
||||
String::new()
|
||||
}
|
||||
|
||||
fn empty_version() -> Version {
|
||||
Version { major: 0, minor: 0, build: 0 }
|
||||
}
|
||||
Reference in New Issue
Block a user