Forced to use Rust
Sometimes I feel my life can be best described as jumping from one rabbit hole to another. The current one I find myself in is terminal UIs. I can’t seem to remember which great TUI app set the spark, but I found myself wanting to write my own. As Python is my drug of choice when it comes to quick experimenting and exploration, I immediately set out to find the best TUI library. I experimented with a few and found that Textual allows me to do what I want to do. The problem is, it does more things, many more things. I don’t know if it’s the object-oriented goo, the CSS injections, the built-in webservers, or something else, but I felt that things built with Textual are anything but minimalistic. Although it is very powerful and plenty of cool things are built with it, I ultimately decided it is not what I need.
After stumbling from library to library, and language to language, I finally found that ratatui is exactly what I am looking for: a single-purpose tool with a tight integration with the terminal, nice functional/declarative style, and elegant building logic (slicing up the terminal and slicing up the slices is weirdly satisfying). The problems
- I had never used Rust before
- I thought of it as a systems programming language—probably more complex than I was comfortable with.
Nevertheless, through a combination of “The Book” and a liberal use of AI, I got myself started with some simple TUI apps. Ratatui got me hooked, so I kept building. At the time of writing this, I believe 3 of my ratatui projects are hosted as public repos on my GitHub page, and several more are in development.
I’d be lying if I said I’m completely comfortable with Rust—or anywhere near it—but the devil was not as black as he was painted. Beyond Ratatui, I’ve come to appreciate several aspects of the language:
- Cargo is a beautifully solid package manager and build system.
- The compiler is surprisingly helpful (no spaghetti stack traces). In fact, I often just fix code in one place and let the compiler guide me through all the downstream issues, instead of trying to anticipate everything in my head.
- Rust enums are delightfully simple to declare and reason with.
Even if I never feel at home with Rust, I am glad I decided to check out ratatui, it is by far the best TUI library I have found in any language. Go’s Bubble Tea is probably second, although it never really gave me that satisfying feeling that ratatui does.
For the forseeable future, I see myself being forced to use ratatui for my TUI projects, and I will gladly Stockholm Syndrome myself into enjoying it.