Add BoxedWidget type alias
This commit is contained in:
parent
54ed495491
commit
3e6b214e81
4 changed files with 26 additions and 18 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue