### Run demo example Source: https://github.com/anekoique/tomlmenu/blob/main/README.md Execute the provided demo to see the TUI in action. ```sh cargo run --example demo ``` -------------------------------- ### Implement tomlmenu configuration Source: https://github.com/anekoique/tomlmenu/blob/main/tomlmenu/README.md Define a struct with the Schema derive macro and use App to run the TUI. ```rust 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, #[tomlmenu(help = "TCP port")] port: Option, #[tomlmenu(help = "Enable TLS")] tls: Option, } fn schema() -> &'static MenuNode { static SCHEMA: OnceLock = 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(()) } ``` -------------------------------- ### Add tomlmenu dependency Source: https://github.com/anekoique/tomlmenu/blob/main/tomlmenu/README.md Include tomlmenu and serde in your Cargo.toml file. ```toml [dependencies] tomlmenu = "0.1" # Add serde yourself only if you load TOML through it. tomlmenu itself # does not depend on serde. serde = { version = "1", features = ["derive"] } ``` -------------------------------- ### Add tomlmenu dependency Source: https://github.com/anekoique/tomlmenu/blob/main/tomlmenu-derive/README.md Include the tomlmenu crate in your Cargo.toml file to access the Schema derive macro. ```toml [dependencies] tomlmenu = "0.1" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.