add revivability
This commit is contained in:
parent
77c50fac64
commit
3e6bfa8c34
4 changed files with 59 additions and 1 deletions
|
|
@ -39,3 +39,16 @@ where
|
|||
Ok(Some(DateTime::from_utc(naive, Utc)))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn int_is_bool<'de, D>(deserializer: D) -> Result<bool, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
let i = i64::deserialize(deserializer)?;
|
||||
|
||||
match i {
|
||||
0 => Ok(false),
|
||||
1 => Ok(true),
|
||||
x => Err(Error::invalid_value(Unexpected::Signed(x), &"0 or 1")),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,6 +340,9 @@ pub struct Profile {
|
|||
|
||||
#[serde(deserialize_with = "deserialize_comp")]
|
||||
pub competition: Option<Competition>,
|
||||
|
||||
#[serde(deserialize_with = "de_util::int_is_bool")]
|
||||
pub revivable: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue