Add Either3 widget

This commit is contained in:
Joscha 2023-02-18 18:30:53 +01:00
parent 15e30dfdb2
commit 828bba464a
2 changed files with 85 additions and 9 deletions

View file

@ -1,6 +1,6 @@
use async_trait::async_trait;
use crate::widgets::{Background, Border, Either, Float, Layer, Padding};
use crate::widgets::{Background, Border, Either, Either3, Float, Layer, Padding};
use crate::{Frame, Size};
// TODO Feature-gate these traits
@ -45,6 +45,18 @@ pub trait WidgetExt: Sized {
Either::Second(self)
}
fn first3<W2, W3>(self) -> Either3<Self, W2, W3> {
Either3::First(self)
}
fn second3<W1, W3>(self) -> Either3<W1, Self, W3> {
Either3::Second(self)
}
fn third3<W1, W2>(self) -> Either3<W1, W2, Self> {
Either3::Third(self)
}
fn float(self) -> Float<Self> {
Float::new(self)
}