global: snapshot part 6

This commit is contained in:
nym21
2026-03-20 17:02:32 +01:00
parent 17106f887a
commit f683adba13
34 changed files with 197 additions and 204 deletions

View File

@@ -62,22 +62,22 @@ impl RealizedMinimal {
.cents
.height
.len()
.min(self.profit.base.cents.height.len())
.min(self.loss.base.cents.height.len())
.min(self.profit.block.cents.height.len())
.min(self.loss.block.cents.height.len())
}
#[inline(always)]
pub(crate) fn push_state(&mut self, state: &CohortState<impl RealizedOps, impl CostBasisOps>) {
self.cap.cents.height.push(state.realized.cap());
self.profit.base.cents.height.push(state.realized.profit());
self.loss.base.cents.height.push(state.realized.loss());
self.profit.block.cents.height.push(state.realized.profit());
self.loss.block.cents.height.push(state.realized.loss());
}
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
vec![
&mut self.cap.cents.height as &mut dyn AnyStoredVec,
&mut self.profit.base.cents.height,
&mut self.loss.base.cents.height,
&mut self.profit.block.cents.height,
&mut self.loss.block.cents.height,
]
}
@@ -88,8 +88,8 @@ impl RealizedMinimal {
exit: &Exit,
) -> Result<()> {
sum_others!(self, starting_indexes, others, exit; cap.cents.height);
sum_others!(self, starting_indexes, others, exit; profit.base.cents.height);
sum_others!(self, starting_indexes, others, exit; loss.base.cents.height);
sum_others!(self, starting_indexes, others, exit; profit.block.cents.height);
sum_others!(self, starting_indexes, others, exit; loss.block.cents.height);
Ok(())
}