added fallback competition case
This commit is contained in:
parent
f28c390394
commit
36210d8c93
|
@ -172,6 +172,7 @@ pub enum Competition {
|
||||||
attacks: i16,
|
attacks: i16,
|
||||||
team: EliminationTeam,
|
team: EliminationTeam,
|
||||||
},
|
},
|
||||||
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deserialize_comp<'de, D>(deserializer: D) -> Result<Option<Competition>, D::Error>
|
fn deserialize_comp<'de, D>(deserializer: D) -> Result<Option<Competition>, D::Error>
|
||||||
|
@ -186,11 +187,15 @@ where
|
||||||
Team,
|
Team,
|
||||||
Attacks,
|
Attacks,
|
||||||
TeamName,
|
TeamName,
|
||||||
|
#[serde(other)]
|
||||||
|
Ignore,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
enum CompetitionName {
|
enum CompetitionName {
|
||||||
Elimination,
|
Elimination,
|
||||||
|
#[serde(other)]
|
||||||
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CompetitionVisitor;
|
struct CompetitionVisitor;
|
||||||
|
@ -294,6 +299,7 @@ where
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CompetitionName::Unknown => Ok(Some(Competition::Unknown)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,7 +363,7 @@ pub struct PersonalStats {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct CriminalRecord {
|
pub struct Crimes1 {
|
||||||
pub selling_illegal_products: i32,
|
pub selling_illegal_products: i32,
|
||||||
pub theft: i32,
|
pub theft: i32,
|
||||||
pub auto_theft: i32,
|
pub auto_theft: i32,
|
||||||
|
@ -369,6 +375,29 @@ pub struct CriminalRecord {
|
||||||
pub total: i32,
|
pub total: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct Crimes2 {
|
||||||
|
pub vandalism: i32,
|
||||||
|
pub theft: i32,
|
||||||
|
pub counterfeiting: i32,
|
||||||
|
pub fraud: i32,
|
||||||
|
#[serde(rename = "illicitservices")]
|
||||||
|
pub illicit_services: i32,
|
||||||
|
#[serde(rename = "cybercrime")]
|
||||||
|
pub cyber_crime: i32,
|
||||||
|
pub extortion: i32,
|
||||||
|
#[serde(rename = "illegalproduction")]
|
||||||
|
pub illegal_production: i32,
|
||||||
|
pub total: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum CriminalRecord {
|
||||||
|
Crimes1(Crimes1),
|
||||||
|
Crimes2(Crimes2),
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in a new issue