Remove Executor::block_on and simplify Compositor creation

This commit is contained in:
Héctor Ramón Jiménez 2025-04-02 10:39:27 +02:00
parent baadcc150f
commit 57cb14ce38
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
13 changed files with 58 additions and 108 deletions

View file

@ -10,7 +10,7 @@ use thiserror::Error;
use std::borrow::Cow;
/// A graphics compositor that can draw to windows.
pub trait Compositor: Sized {
pub trait Compositor: Sized + MaybeSend {
/// The iced renderer of the backend.
type Renderer;
@ -21,7 +21,7 @@ pub trait Compositor: Sized {
fn new<W: Window + Clone>(
settings: Settings,
compatible_window: W,
) -> impl Future<Output = Result<Self, Error>> {
) -> impl Future<Output = Result<Self, Error>> + MaybeSend {
Self::with_backend(settings, compatible_window, None)
}
@ -33,7 +33,7 @@ pub trait Compositor: Sized {
_settings: Settings,
_compatible_window: W,
_backend: Option<&str>,
) -> impl Future<Output = Result<Self, Error>>;
) -> impl Future<Output = Result<Self, Error>> + MaybeSend;
/// Creates a [`Self::Renderer`] for the [`Compositor`].
fn create_renderer(&self) -> Self::Renderer;