sum_tree: Do not implement Dimension on tuples, use new Dimensions wrapper instead (#35482)

This is a bit of a readability improvement IMHO; I often find myself
confused when dealing when dimension pairs, as there's no easy way to
jump to the implementation of a dimension for tuples to remind myself
for the n-th time how exactly that impl works. Now it should be possible
to jump directly to that impl.

Another bonus is that Dimension supports 3-ary tuples as well - by using
a () as a default value of a 3rd dimension.


Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-05 02:37:22 +02:00 committed by GitHub
parent be2f54b233
commit 07e3d53d58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 215 additions and 141 deletions

View file

@ -6,7 +6,7 @@ use db::smol::stream::StreamExt;
use gpui::{App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task};
use rpc::{Notification, TypedEnvelope, proto};
use std::{ops::Range, sync::Arc};
use sum_tree::{Bias, SumTree};
use sum_tree::{Bias, Dimensions, SumTree};
use time::OffsetDateTime;
use util::ResultExt;
@ -360,7 +360,9 @@ impl NotificationStore {
is_new: bool,
cx: &mut Context<NotificationStore>,
) {
let mut cursor = self.notifications.cursor::<(NotificationId, Count)>(&());
let mut cursor = self
.notifications
.cursor::<Dimensions<NotificationId, Count>>(&());
let mut new_notifications = SumTree::default();
let mut old_range = 0..0;