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

@ -2,17 +2,17 @@ use async_trait::async_trait;
use crossterm::style::ContentStyle;
use toss::frame::{Frame, Pos, Size};
use super::Widget;
use super::{BoxedWidget, Widget};
pub struct Background {
inner: Box<dyn Widget + Send>,
inner: BoxedWidget,
style: ContentStyle,
}
impl Background {
pub fn new<W: 'static + Widget + Send>(inner: W, style: ContentStyle) -> Self {
pub fn new<W: Into<BoxedWidget>>(inner: W, style: ContentStyle) -> Self {
Self {
inner: Box::new(inner),
inner: inner.into(),
style,
}
}