Add a Summary trait in preparation of passing a context struct

This commit is contained in:
Antonio Scandurra
2021-05-06 09:32:14 +02:00
parent f7d8b6b4c0
commit 7fb7a6adfc
7 changed files with 56 additions and 45 deletions
+3 -3
View File
@@ -421,8 +421,8 @@ impl sum_tree::Item for Transform {
}
}
impl<'a> std::ops::AddAssign<&'a Self> for TransformSummary {
fn add_assign(&mut self, other: &'a Self) {
impl sum_tree::Summary for TransformSummary {
fn add_summary(&mut self, other: &Self) {
self.buffer += &other.buffer;
self.display += &other.display;
}
@@ -430,7 +430,7 @@ impl<'a> std::ops::AddAssign<&'a Self> for TransformSummary {
impl<'a> Dimension<'a, TransformSummary> for TransformSummary {
fn add_summary(&mut self, summary: &'a TransformSummary) {
*self += summary;
sum_tree::Summary::add_summary(self, summary);
}
}