Pass Summary::Context to Item::summarize (#18510)

We are going to use this in the multi-buffer to produce a summary for an
`Excerpt` that contains a `Range<Anchor>`.

Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2024-09-29 10:30:48 -06:00 committed by GitHub
parent 8aeab4800c
commit 84ce81caf1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 31 additions and 31 deletions

View file

@ -69,7 +69,7 @@ impl Default for Locator {
impl sum_tree::Item for Locator {
type Summary = Locator;
fn summary(&self) -> Self::Summary {
fn summary(&self, _cx: &()) -> Self::Summary {
self.clone()
}
}

View file

@ -107,7 +107,7 @@ impl<'a> Dimension<'a, OperationSummary> for OperationKey {
impl<T: Operation> Item for OperationItem<T> {
type Summary = OperationSummary;
fn summary(&self) -> Self::Summary {
fn summary(&self, _cx: &()) -> Self::Summary {
OperationSummary {
key: OperationKey::new(self.0.lamport_timestamp()),
len: 1,

View file

@ -2617,7 +2617,7 @@ impl Fragment {
impl sum_tree::Item for Fragment {
type Summary = FragmentSummary;
fn summary(&self) -> Self::Summary {
fn summary(&self, _cx: &Option<clock::Global>) -> Self::Summary {
let mut max_version = clock::Global::new();
max_version.observe(self.timestamp);
for deletion in &self.deletions {
@ -2688,7 +2688,7 @@ impl Default for FragmentSummary {
impl sum_tree::Item for InsertionFragment {
type Summary = InsertionFragmentKey;
fn summary(&self) -> Self::Summary {
fn summary(&self, _cx: &()) -> Self::Summary {
InsertionFragmentKey {
timestamp: self.timestamp,
split_offset: self.split_offset,
@ -2700,7 +2700,7 @@ impl sum_tree::KeyedItem for InsertionFragment {
type Key = InsertionFragmentKey;
fn key(&self) -> Self::Key {
sum_tree::Item::summary(self)
sum_tree::Item::summary(self, &())
}
}

View file

@ -11,7 +11,7 @@ struct UndoMapEntry {
impl sum_tree::Item for UndoMapEntry {
type Summary = UndoMapKey;
fn summary(&self) -> Self::Summary {
fn summary(&self, _cx: &()) -> Self::Summary {
self.key
}
}