computer: convert vecs functions to iterators

This commit is contained in:
nym21
2025-09-10 16:25:38 +02:00
parent dfa077a1c9
commit 9b92c5ce38
47 changed files with 2037 additions and 1330 deletions

View File

@@ -475,8 +475,7 @@ impl Vecs {
};
this.db.retain_regions(
this.vecs()
.into_iter()
this.iter_any_collectable()
.flat_map(|v| v.region_names())
.collect(),
)?;
@@ -934,9 +933,9 @@ impl Vecs {
})
}
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
vec![
&self.dateindex_to_date,
pub fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn AnyCollectableVec> {
[
&self.dateindex_to_date as &dyn AnyCollectableVec,
&self.dateindex_to_dateindex,
&self.dateindex_to_first_height,
&self.dateindex_to_height_count,
@@ -997,6 +996,7 @@ impl Vecs {
&self.yearindex_to_yearindex,
&self.outputindex_to_txindex,
]
.into_iter()
}
}