lv-tui 0.2.0

A reactive TUI framework for Rust, inspired by Textual and React
Documentation
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()
    }
}