Add BoxedSencSync which is Send + Sync

This commit is contained in:
Joscha 2023-04-17 20:26:26 +02:00
parent 968dbe501f
commit f414db40d5
2 changed files with 77 additions and 44 deletions

View file

@ -1,8 +1,8 @@
use async_trait::async_trait;
use crate::widgets::{
Background, Border, Boxed, BoxedAsync, Desync, Either2, Either3, Float, JoinSegment, Layer2,
Padding, Resize,
Background, Border, Boxed, BoxedAsync, BoxedSendSync, Desync, Either2, Either3, Float,
JoinSegment, Layer2, Padding, Resize,
};
use crate::{Frame, Size, WidthDb};
@ -47,6 +47,13 @@ pub trait WidgetExt: Sized {
Boxed::new(self)
}
fn boxed_send_sync<'a, E>(self) -> BoxedSendSync<'a, E>
where
Self: Widget<E> + Send + Sync + 'a,
{
BoxedSendSync::new(self)
}
fn boxed_async<'a, E>(self) -> BoxedAsync<'a, E>
where
Self: AsyncWidget<E> + Send + Sync + 'a,