mirror of
https://github.com/lov3b/ecb-rates.git
synced 2025-06-28 16:00:23 +02:00
Only overwrite old cache if an update was made
This commit is contained in:
9
src/cache/cache_line.rs
vendored
9
src/cache/cache_line.rs
vendored
@ -9,7 +9,7 @@ use crate::Hollidays;
|
||||
|
||||
const CET: FixedOffset = unsafe { FixedOffset::east_opt(3600).unwrap_unchecked() };
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq)]
|
||||
pub struct CacheLine {
|
||||
#[serde(with = "ts_seconds")]
|
||||
date: DateTime<Utc>,
|
||||
@ -86,6 +86,13 @@ impl CacheLine {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<Vec<ExchangeRateResult>> for CacheLine {
|
||||
fn eq(&self, other: &Vec<ExchangeRateResult>) -> bool {
|
||||
&self.exchange_rate_results == other
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
Reference in New Issue
Block a user