use crate::component::Component;
use crate::runtime::Runtime;
use crate::Result;
/// lv-tui 应用入口
///
/// ```rust,ignore
/// App::new(MyRoot::new()).run()
/// ```
pub struct App<C: Component> {
root: C,
}
impl<C: Component + 'static> App<C> {
pub fn new(root: C) -> Self {
Self { root }
}
/// 启动应用主循环
pub fn run(self) -> Result<()> {
Runtime::new(self.root)?.run()
}
}