mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Generalize Dimension<FragmentSummary> for tuples
This commit is contained in:
parent
84fe7f50ac
commit
60a1d47c96
1 changed files with 6 additions and 9 deletions
|
@ -2258,17 +2258,14 @@ impl<'a> sum_tree::SeekDimension<'a, FragmentSummary> for VersionedOffset {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> sum_tree::Dimension<'a, FragmentSummary> for (VersionedOffset, usize) {
|
||||
impl<'a, T, U> sum_tree::Dimension<'a, FragmentSummary> for (T, U)
|
||||
where
|
||||
T: sum_tree::Dimension<'a, FragmentSummary>,
|
||||
U: sum_tree::Dimension<'a, FragmentSummary>,
|
||||
{
|
||||
fn add_summary(&mut self, summary: &'a FragmentSummary, cx: &Option<time::Global>) {
|
||||
self.0.add_summary(summary, cx);
|
||||
self.1 += summary.text.visible;
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> sum_tree::Dimension<'a, FragmentSummary> for (VersionedOffset, FullOffset) {
|
||||
fn add_summary(&mut self, summary: &'a FragmentSummary, cx: &Option<time::Global>) {
|
||||
self.0.add_summary(summary, cx);
|
||||
self.1 .0 += summary.text.visible + summary.text.deleted;
|
||||
self.1.add_summary(summary, cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue