Expand description
Reusable ratatui-driven menuconfig TUI for editing a TOML config file in place.
The library exposes three primary entry points:
Document— wrapstoml_edit::DocumentMutplus an on-disk path;load/get/set/clear/savewith atomic-rename writes.Schema— trait + derive macro. Apply#[derive(Schema)]to any serde-annotated user type to produce a staticMenuNodetree. The derive is re-exported from the companiontomlmenu-derivecrate under thederivefeature, which is enabled by default.App— top-level lifecycle:App::new(schema, document, shadowed)thenApp::run() -> (ExitReason, Document).
The library is unsafe_code = "deny" and has no opinion about which
TOML file you are editing. Consumers own (a) the user struct annotated
with #[derive(Schema)], (b) loading the Document, and (c) deciding
whether to call Document::save after ExitReason::Saved.
Structs§
- App
- The top-level menuconfig application.
- Document
- A mutable view over the on-disk TOML config file.
- Menu
Node - A node in the menu schema tree.
Enums§
- Exit
Reason - The verdict returned from
App::run. The consumer decides whether to persist onSaved(typically by callingDocument::saveon the returned document) or discard. - Leaf
Kind - Editor kind for a leaf node.
- Menu
Body - What a
MenuNodecontains.
Traits§
- Schema
- A type that exposes a static menu schema.
Functions§
- install_
panic_ hook - Install a panic hook that invokes each
RestoreActionin order before re-invoking the previous hook. Replaces any list previously registered with this function. - require_
tty - Refuse to start the TUI when stdio is not interactive. Returns Err so the caller surfaces a clear stderr line and exits with code 2.
Type Aliases§
- Restore
Action - A side-effect run on panic or normal teardown to restore the terminal.
- Result
- Library-wide error alias.
Derive Macros§
- Schema
- The
#[derive(Schema)]proc-macro, re-exported fromtomlmenu-derive.