1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use crate::{Component, Node, Widget};
use std::{fmt::Debug, rc::Rc};

#[cfg(feature = "with-html")]
pub mod html;
#[cfg(feature = "with-html")]
pub use html::HtmlBackend;
#[cfg(feature = "with-tui")]
pub mod text_ui;

#[cfg(feature = "with-gtk")]
pub mod gtk_ui;

pub trait Backend<APP, MSG>
where
    MSG: Clone + Debug + 'static,
    APP: Component<MSG> + 'static,
{
    fn init(app: APP) -> Rc<Self>;

    fn start_render(self: &Rc<Self>) {
        // html backend don't use render loop
        //
        // this is useful for tui backend
    }
}