fixed torn->competition

This commit is contained in:
TotallyNot 2023-07-29 17:43:24 +02:00
parent 4f3d62da95
commit 250624eb22
2 changed files with 3 additions and 2 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "torn-api" name = "torn-api"
version = "0.5.19" version = "0.5.20"
edition = "2021" edition = "2021"
authors = ["Pyrit [2111649]"] authors = ["Pyrit [2111649]"]
license = "MIT" license = "MIT"

View file

@ -43,6 +43,7 @@ pub struct EliminationLeaderboard {
pub enum Competition { pub enum Competition {
Elimination { teams: Vec<EliminationLeaderboard> }, Elimination { teams: Vec<EliminationLeaderboard> },
Unkown(String),
} }
fn decode_competition<'de, D>(deserializer: D) -> Result<Option<Competition>, D::Error> fn decode_competition<'de, D>(deserializer: D) -> Result<Option<Competition>, D::Error>
@ -98,7 +99,7 @@ where
teams: teams.ok_or_else(|| de::Error::missing_field("teams"))?, teams: teams.ok_or_else(|| de::Error::missing_field("teams"))?,
})), })),
"" => Ok(None), "" => Ok(None),
v => Err(de::Error::unknown_variant(v, &["Elimination", ""])), v => Ok(Some(Competition::Unkown(v.to_owned()))),
} }
} }
} }