ratflow 0.1.0

A minimalistic framework for building TUI applications using a reactive architecture.
Documentation
use ratatui::Frame;

pub trait Render: Send + Sync {
    fn render(&self, frame: &mut Frame);
}

impl<F> Render for F
where
    F: Fn(&mut Frame) + Send + Sync,
{
    #[inline]
    fn render(&self, frame: &mut Frame) {
        (self)(frame)
    }
}

pub trait Component<F: Render> {
    fn create(self) -> F;
}

impl<F, C> Component<F> for C
where
    C: FnOnce() -> F,
    F: Render,
{
    #[inline]
    fn create(self) -> F {
        (self)()
    }
}