tomlmenu
A reusable ratatui-based menuconfig TUI for editing TOML config files in
place — like Linux make menuconfig, but for any serde-annotated Rust
struct.

Quick start
[dependencies]
tomlmenu = "0.1"
serde = { version = "1", features = ["derive"] }
use std::{path::Path, sync::OnceLock};
use serde::Deserialize;
use tomlmenu::{App, Document, ExitReason, MenuNode, Schema};
#[derive(Debug, Default, Deserialize, Schema)]
struct Config {
#[tomlmenu(help = "Bind host, e.g. 0.0.0.0")]
host: Option<String>,
#[tomlmenu(help = "TCP port")]
port: Option<u16>,
#[tomlmenu(help = "Enable TLS")]
tls: Option<bool>,
}
fn schema() -> &'static MenuNode {
static SCHEMA: OnceLock<MenuNode> = OnceLock::new();
SCHEMA.get_or_init(Config::menu_schema)
}
fn main() -> anyhow::Result<()> {
tomlmenu::require_tty()?;
let document = Document::load(Path::new("config.toml"))?;
let (exit, document) = App::new(schema(), document, &[]).run()?;
if matches!(exit, ExitReason::Saved) {
document.save()?;
}
Ok(())
}
Feature flags
| Feature |
Default |
What it does |
derive |
on |
Re-exports #[derive(Schema)] from tomlmenu-derive. |
Disable with default-features = false if you only need the runtime
types and want to hand-roll your own MenuNode trees.
Documentation & demo
See the project repository for
the full keymap reference, attribute reference, and a runnable demo
(cargo run --example demo).
License
MIT.