Add BoxedWidget type alias

This commit is contained in:
Joscha 2022-07-20 22:25:27 +02:00
parent 54ed495491
commit 3e6b214e81
4 changed files with 26 additions and 18 deletions

View file

@ -14,3 +14,11 @@ pub trait Widget {
async fn render(self: Box<Self>, frame: &mut Frame);
}
pub type BoxedWidget = Box<dyn Widget + Send>;
impl<W: 'static + Widget + Send> From<W> for BoxedWidget {
fn from(widget: W) -> Self {
Box::new(widget)
}
}