Add Desync widget to turn Widgets into AsyncWidgets

This commit is contained in:
Joscha 2023-04-17 19:36:44 +02:00
parent 57788a9dd9
commit 4179e7f56c
3 changed files with 49 additions and 2 deletions

View file

@ -1,8 +1,8 @@
use async_trait::async_trait;
use crate::widgets::{
Background, Border, Boxed, BoxedAsync, Either2, Either3, Float, JoinSegment, Layer2, Padding,
Resize,
Background, Border, Boxed, BoxedAsync, Desync, Either2, Either3, Float, JoinSegment, Layer2,
Padding, Resize,
};
use crate::{Frame, Size, WidthDb};
@ -53,6 +53,9 @@ pub trait WidgetExt: Sized {
{
BoxedAsync::new(self)
}
fn desync(self) -> Desync<Self> {
Desync(self)
}
fn first2<W2>(self) -> Either2<Self, W2> {
Either2::First(self)