Skip to main content

Crate flux_tui

Crate flux_tui 

Source
Expand description

§Flux TUI

Flux TUI is a library which tries to unify both rendering Terminal UIs and event handling

§Main features:

  • Hierachical reference counted structure
  • Events get automatically delegated to the focused child and if unhandled bubble up
  • Premade existing implementations of well-known components (still getting improved tho)
  • Lightweight and relies only on few dependencies

§Getting started:

use flux_tui::tui::Tui;
use flux_tui::window::*;
use flux_tui::canvas::Canvas;

use std::rc::Rc;
use std::cell::RefCell;

struct Start(WindowUID);

impl Start{
    fn new() -> Self{
        Self(WindowUID::new())
    }
}

impl Window for Start{
    fn render(&self, canvas: &mut Canvas){}
}

impl WindowLayout for Start{}

impl HasWindowUID for Start{
    fn uid(&self) -> WindowUID{
        self.0
    }
}

// Construct your Window implementation here
let control: WindowRef = Rc::new(RefCell::new(Start::new()));
let mut tui = Tui::new(control.clone()).unwrap();
while let Ok(()) = tui.handle_next_event() {
    tui.render().unwrap();
}

Modules§

canvas
common
components
misc
tui
window