| Crates.io | unsegen |
| lib.rs | unsegen |
| version | 0.3.1 |
| created_at | 2019-02-24 22:04:38.502266+00 |
| updated_at | 2025-03-09 10:34:17.638071+00 |
| description | Another tui library |
| homepage | |
| repository | https://github.com/ftilde/unsegen |
| max_upload_size | |
| id | 116974 |
| size | 545,132 |
unsegen is a library facilitating the creation of text user interface (TUI) applications akin to ncurses.
Currently, unsegen only provides a Rust interface.
The library consists of four modules:
Terminal setup, "slicing" using Windows, and formatted writing to Windows using Cursors.Widget abstraction and some basic Widgets useful for creating basic building blocks of text user interfaces.Behavior and means to easily distribute events.Containers as the combination of widget and input concepts.The following libraries are built on top of unsegen and provide higher level functionality:
unsegen is available on crates.io. You can install it by adding this line to your Cargo.toml:
unsegen = "0.3.1"
Here is a screenshot of ugdb, which is built on top of unsegen.

There are examples at the top of each main modules' documentation (i.e., base, input, widget, and container) which should be sufficient to get you going.
For a fully fledged application using unsegen, you can have a look at ugdb, which was developed alongside unsegen and the primary motivation for it.
For simplicity, layouting is done in every draw call.
This, in conjunction with recursive calls to calculate space demand of widgets, leads to not-so-great asymptotic runtime.
However, I found this not to be a problem in practice so far.
If this is problematic for, please file an issue.
There are workarounds (caching the draw-result of widgets) for which convenient wrappers can be implemented in the library, but have not so far.
unsegen is released under the MIT license.