petitcarnets
Terminal user interfaces in the Elm architecture (model, update, view), for Rust, with no dependencies, following Bubble Tea v2.

[dependencies]
petitcarnets = "0.0.11"
Why petitcarnets
- A Go programmer reads it on sight.
Program,Model,Msg,CmdandView, Bubble Tea's key strings and Bubbles' key maps, under the same names. The guide from Go maps each one. - No dependencies.
cargo treeprints one crate. The terminal is driven through a handful of libc calls in one audited module, the only place withunsafe. - It restores your terminal. Raw mode and every terminal mode are undone on quit, on panic (in
updateor in a task), onSIGINTandSIGTERM, and around anexecor a suspend, with no key lost or read twice; a real-terminal test checks each one in CI. - Messages are yours. Your own enum, matched exhaustively, instead of
Box<dyn Any>and downcasts.
A counter in thirty lines
use petitcarnets as tea;
;
The model is your state, update turns a message into a new state and maybe a command, and view draws it.
Fewer bytes to the terminal
Bytes written per frame, mean over 100 frames on an 80x24 screen, inline. Byte counts do not depend on the machine.
| Scenario | petitcarnets | Others |
|---|---|---|
| log (24 lines, one new per frame) | 659 | Bubble Tea v2: 1,230; bubbletea-rs: 1,253 |
| list (20 items, cursor moves) | 31.7 | Bubble Tea v2: 32.4; charmed-bubbletea: 241.0 |
Methodology and every scenario: Benchmarks.
When not to use it
No Windows yet, a smaller ecosystem than ratatui, and no Lip Gloss layers, Huh or Wish. The comparison has the evidence.
Read on
- The manual: the guide from Go, the architecture, the examples, benchmarks and policies.
- API reference on docs.rs.
- Source and issues on GitHub.