Implement FoldMap's folds using a SumTree
This required passing a `Context` object to `Summary` and introducing a new `SeekDimension` trait that allows comparing two dimensions and pass an additional context object.
This commit is contained in:
@@ -2103,6 +2103,8 @@ impl sum_tree::Item for Fragment {
|
||||
}
|
||||
|
||||
impl sum_tree::Summary for FragmentSummary {
|
||||
type Context = ();
|
||||
|
||||
fn add_summary(&mut self, other: &Self) {
|
||||
self.text_summary += &other.text_summary;
|
||||
debug_assert!(self.max_fragment_id <= other.max_fragment_id);
|
||||
@@ -2167,6 +2169,8 @@ impl sum_tree::Item for InsertionSplit {
|
||||
}
|
||||
|
||||
impl sum_tree::Summary for InsertionSplitSummary {
|
||||
type Context = ();
|
||||
|
||||
fn add_summary(&mut self, other: &Self) {
|
||||
self.extent += other.extent;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ pub struct TextSummary {
|
||||
}
|
||||
|
||||
impl sum_tree::Summary for TextSummary {
|
||||
type Context = ();
|
||||
|
||||
fn add_summary(&mut self, other: &Self) {
|
||||
*self += other;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user