pub(crate) fn deserialize<'de, D>(deserializer: D) -> Result<NaiveDate, D::Error>
where
    D: Deserializer<'de>,
{
    let s = String::deserialize(deserializer)?;
    NaiveDate::parse_from_str(&s, FORMAT)
        .or_else(|_err| NaiveDate::parse_from_str(&format!("{}-01", &s), FORMAT))
        .or_else(|_err| NaiveDate::parse_from_str(&format!("{}-01-01", &s), FORMAT))
        .map_err(serde::de::Error::custom)
}
/// Some times, music brainz dates doesn't have a month or day
/// This artificially add january 1st before deserializing the API response
Some times, music brainz dates doesn't have a month or day
This artificially add january 1st before deserializing the API response
Some times music brainz dates doesn ' t have a month or day This artificially add january 1st before deserializing the API response
pub(crate) fn deserialize<'de, D>(deserializer: D) -> Result<NaiveDate, D::Error>
where
    D: Deserializer<'de>,
{
    let s = String::deserialize(deserializer)?;
    NaiveDate::parse_from_str(&s, FORMAT)
        .or_else(|_err| NaiveDate::parse_from_str(&format!("{}-01", &s), FORMAT))
        .or_else(|_err| NaiveDate::parse_from_str(&format!("{}-01-01", &s), FORMAT))
        .map_err(serde::de::Error::custom)
}
pub ( crate ) fn deserialize < ' de , D > ( deserializer : D ) -> Result < NaiveDate , D :: Error > where D : Deserializer < ' de > , { let s = String :: deserialize ( deserializer ) ? ; NaiveDate :: parse_from_str ( & s , FORMAT ) . or_else ( | _err | NaiveDate :: parse_from_str ( & format ! ( " " s ) , FORMAT ) ) . or_else ( | _err | NaiveDate :: parse_from_str ( & format ! ( " " s ) , FORMAT ) ) . map_err ( serde :: de :: Error :: custom ) }
Some times, music brainz dates doesn't have a month or day
This artificially add january 1st before deserializing the API response
Some times music brainz dates doesn ' t have a month or day This artificially add january 1st before deserializing the API response
deserializer
D
deserializer
D