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

@@ -131,14 +131,10 @@ impl ComputedValueVecsFromDateIndex {
Ok(())
}
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[
self.sats.vecs(),
self.bitcoin.vecs(),
self.dollars.as_ref().map_or(vec![], |v| v.vecs()),
]
.into_iter()
.flatten()
.collect::<Vec<_>>()
pub fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn AnyCollectableVec> {
std::iter::empty()
.chain(self.sats.iter_any_collectable())
.chain(self.bitcoin.iter_any_collectable())
.chain(self.dollars.iter().flat_map(|v| v.iter_any_collectable()))
}
}