Make summaries_for_anchors/summaries_for_anchor_ranges more generic

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-11-25 17:03:06 +01:00
parent 2f43ef67fd
commit 2f78d93383
2 changed files with 39 additions and 22 deletions

View file

@ -142,8 +142,12 @@ impl<T> AnchorMap<T> {
{
let content = content.into();
content
.summaries_for_anchors(self)
.map(move |(sum, value)| (sum, value))
.summaries_for_anchors(
self.version.clone(),
self.bias,
self.entries.iter().map(|e| &e.0),
)
.zip(self.entries.iter().map(|e| &e.1))
}
}
@ -196,7 +200,14 @@ impl<T> AnchorRangeMap<T> {
D: 'a + TextDimension<'a>,
{
let content = content.into();
content.summaries_for_anchor_ranges(self)
content
.summaries_for_anchor_ranges(
self.version.clone(),
self.start_bias,
self.end_bias,
self.entries.iter().map(|e| &e.0),
)
.zip(self.entries.iter().map(|e| &e.1))
}
pub fn full_offset_ranges(&self) -> impl Iterator<Item = &(Range<FullOffset>, T)> {