termint
termint is high-performance, structural TUI (Terminal User Interface) library and framework for Rust.
Table of Contents
How to get it
This crate is available on crates.io.
With cargo
cargo add termint
In Cargo.toml
[]
= "0.7.0"
Features
backend-crossterm: Enables Crossterm as the event-reading backend.backend-termal: Enables Termal as the event-reading backend.serde: Enables serialization and deserialization of some structs.all: Enables all features.
backend-crossterm is enabled by default. If both backend-crossterm and
backend-termal are enabled, Termint defaults to Crossterm, unless
specified otherwise via Term::<Backend>::init().
Examples
Framework Mode
Note: To use
Framework mode, you must enable either thebackend-crosstermorbackend-termalfeature.
Termint provides the Application trait to manage the UI lifecycle. You can
then use Term::run, which runs the main loop, handles the input events and
efficient rendering all using the given Application implementation.
use *;
;
Manual Mode
If you prefer to manage you own loop, you can use the manual mode, where
Term manages only terminal state and rendering. Everything else, such as the
main loop, event handling and so on, you have to implement yourself.
use *;
Colored printing
Colored printing is really easy, you can do it by using any Text widget.
Here is an example of using Span widget:
use *;
println!;
println!;
println!;
println!;
You can also use re-exported termal crate to print colored text:
use printcln;
printcln!;
printcln!;
printcln!;
TUI examples
Usage
Code blocks above are just examples of the usage. To see more about functions, Widgets and more, please visit the documentation.
You can also check the examples directory of this repository for more
examples of how to use this crate for creating TUIs.
Projects
Here is a list of some projects using termint:
Links
- Author: Martan03
- GitHub repository: termint
- Package: crates.io
- Documentation: docs.rs
- Author website: martan03.github.io