Skip to content

A template for bootstrapping a Rust TUI application with tui-rs & crossterm

Notifications You must be signed in to change notification settings

sccvn/rust-tui-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-tui-template

A template for bootstrapping a Rust TUI application with tui-rs & crossterm.

tui-rs

The library is based on the principle of immediate rendering with intermediate buffers. This means that at each new frame you should build all widgets that are supposed to be part of the UI. While providing a great flexibility for rich and interactive UI, this may introduce overhead for highly dynamic content. So, the implementation try to minimize the number of ansi escapes sequences generated to draw the updated UI. In practice, given the speed of Rust the overhead rather comes from the terminal emulator than the library itself.

crossterm

Crossterm is a pure-rust, terminal manipulation library that makes it possible to write cross-platform text-based interfaces (see features). It supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested, see Tested Terminals for more info).

Structure

src/
├── app.rs     -> holds the states and renders the widgets
├── event.rs   -> handles the terminal events (key press, mouse click, resize, etc.)
├── handler.rs -> handles the key press events and updates the application
├── lib.rs     -> module definitions
├── main.rs    -> entry-point
└── tui.rs     -> initializes/exits the terminal interface

Usage

  1. Install cargo-generate
cargo install cargo-generate
  1. Clone this repository via cargo-generate:
cargo generate --git https://github.com/orhun/rust-tui-template --name <project-name>

See also

About

A template for bootstrapping a Rust TUI application with tui-rs & crossterm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%