aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillermo Ramos2025-03-16 13:30:13 +0100
committerGuillermo Ramos2025-03-16 20:00:39 +0100
commit18e4ca440cf1b9d8d20e3e24bac0c55bbd9efada (patch)
treeef4b16f7ab0d91bc0e9256c75907d3877be4d74c /src
parent069e902819955d26adc8045a760c1ccfa4be549e (diff)
downloadhiccup-18e4ca440cf1b9d8d20e3e24bac0c55bbd9efada.tar.gz
Add updates
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib.rs b/src/lib.rs
index cf8240c..39f225f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,3 @@
-use std::collections::HashMap;
use std::fmt;
use std::ops::AddAssign;
@@ -234,7 +233,7 @@ pub struct PeriodicUpdate {
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct SimUpdates {
periodic: Vec<PeriodicUpdate>,
- by_month: HashMap<u32, SimUpdate>,
+ by_month: Vec<(u32, SimUpdate)>,
}
impl SimUpdates {
@@ -257,8 +256,8 @@ impl SimUpdates {
ret.push(*update);
}
}
- if let Some(update) = by_month.get(&month) {
- ret.push(*update);
+ for update in by_month.iter().filter(|(m, _u)| *m == month) {
+ ret.push(update.1);
}
// println!(" {self:?}.get({month}) -> {ret:?}");
ret
@@ -269,7 +268,7 @@ impl SimUpdates {
self.periodic.push(p.clone());
}
for (k, v) in other.by_month {
- self.by_month.insert(k, v);
+ self.by_month.push((k, v));
}
self
}
@@ -309,7 +308,7 @@ impl SimUpdate {
pub fn at(&self, month: u32) -> SimUpdates {
let mut updates = SimUpdates::default();
- updates.by_month.insert(month, *self);
+ updates.by_month.push((month, *self));
updates
}
}