The tvision-rs Developer Guide
tvision-rs is a TUI framework for Rust: a faithful, idiomatic port of magiblot/tvision, the modern C++ version of Borland's Turbo Vision. An app built with this crate looks and behaves like a DOS-era Turbo Vision program, with overlapping windows, a menu bar at the top and a status line at the bottom.
A Turbo Vision veteran recognises the framework, and the code is native Rust
without inheritance, raw pointers or a preprocessor. The class
hierarchy became a View trait plus composition; TView* pointers became
ViewId handles; the cmXxx/sfXxx constant families became namespaced
consts and named boolean fields. The event loop, the modal dialogs, the draw
model and the widget set behave as in Turbo Vision.
The tv:: house style
By convention the crate is imported under the short alias tv, and the historic
T prefix is dropped. TButton is tv::Button, TDialog is tv::Dialog,
TProgram is tv::Program. A Turbo Vision class maps to a tv:: type by this
rule:
| C++ Turbo Vision | tvision-rs (Rust) |
|---|---|
TButton | tv::Button |
TWindow | tv::Window |
TDeskTop | tv::Desktop |
TMenuBar | tv::MenuBar |
TStatusLine | tv::StatusLine |
How to read these docs
This documentation has two layers served as one site:
- The Guide (these pages) is the narrative you read to learn. It is organised by task and by concept, carries colored screenshots of running programs, and pulls its code from compiled examples.
- The API reference is the per-type reference:
every struct, trait, and method, generated by
rustdocfrom the source. When the Guide names a type it links into the API, and the API links back into the Guide. Use the Guide ⇄ API toggle in the top bar to move between them.
A suggested path:
- Getting Started: add the crate, build and run your first app.
- If you are coming from C++ Turbo Vision, read The Idiomatic Port next: it explains the ideas behind each deviation.
- Otherwise jump to Building Apps for task recipes.
The data-movement model explains in one place how
values travel between dialogs, controls, siblings,
and modals. Dip into How It Works when you want
to write your own
View.