Add Either widget

This commit is contained in:
Joscha 2023-02-17 21:27:46 +01:00
parent 8834bb6d9d
commit 95a01d5fc8
3 changed files with 70 additions and 1 deletions

View file

@ -1,6 +1,6 @@
use async_trait::async_trait;
use crate::widgets::{Background, Border, Float, Padding, Layer};
use crate::widgets::{Background, Border, Either, Float, Layer, Padding};
use crate::{Frame, Size};
// TODO Feature-gate these traits
@ -37,6 +37,14 @@ pub trait WidgetExt: Sized {
Border::new(self)
}
fn first<W>(self) -> Either<Self, W> {
Either::First(self)
}
fn second<W>(self) -> Either<W, Self> {
Either::Second(self)
}
fn float(self) -> Float<Self> {
Float::new(self)
}