sum_tree: Replace rayon with futures (#41586)

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Co-authored by: Kate <kate@zed.dev>
This commit is contained in:
Lukas Wirth
2025-10-31 10:39:01 +00:00
committed by GitHub
parent 7c29c6d7a6
commit f2ce06c7b0
67 changed files with 1271 additions and 640 deletions
+13
View File
@@ -260,6 +260,19 @@ impl AsyncApp {
}
}
impl sum_tree::BackgroundSpawn for BackgroundExecutor {
type Task<R>
= Task<R>
where
R: Send + Sync;
fn background_spawn<R>(&self, future: impl Future<Output = R> + Send + 'static) -> Self::Task<R>
where
R: Send + Sync + 'static,
{
self.spawn(future)
}
}
/// A cloneable, owned handle to the application context,
/// composed with the window associated with the current task.
#[derive(Clone, Deref, DerefMut)]
+5
View File
@@ -393,6 +393,11 @@ impl TestAppContext {
}
}
/// Returns the background executor for this context.
pub fn background_executor(&self) -> &BackgroundExecutor {
&self.background_executor
}
/// Wait until there are no more pending tasks.
pub fn run_until_parked(&mut self) {
self.background_executor.run_until_parked()
+1 -1
View File
@@ -342,7 +342,7 @@ impl BackgroundExecutor {
/// for all of them to complete before returning.
pub async fn scoped<'scope, F>(&self, scheduler: F)
where
F: FnOnce(&mut Scope<'scope>),
F: for<'a> FnOnce(&'a mut Scope<'scope>),
{
let mut scope = Scope::new(self.clone());
(scheduler)(&mut scope);