Mingling's complete feature list
# Preset Feature Groups Mingling provides a set of **preset feature groups** that make it easy to enable features in whatever combination you need. ## `mini` **Enables features:** `extras`, `picker` **Positioning:** Minimal mode, suitable for small CLI tools or projects that need to get started quickly. Includes only the most essential convenience macros and argument parsing capabilities. ## `advanced` **Enables features:** `extras`, `picker`, `repl`, `comp`, `dispatch_tree`, `structural_renderer` **Positioning:** Advanced mode, builds on `mini` by adding an interactive REPL environment, code completion, dispatch tree acceleration, and basic structured output capabilities. Suitable for medium-sized command-line applications with a fuller feature set. ## `full` **Enables features:** `extras`, `picker`, `repl`, `clap`, `comp`, `dispatch_tree`, `structural_renderer_full`, `pathf` **Positioning:** Full mode, enables all of Mingling's core functionality. In addition to `advanced`, it includes clap integration, the full structural renderer (with all serialization formats), and the experimental path analyzer. Suitable for large, feature-complete command-line applications. ## `build_advanced` **Enables features:** `build`, `comp` **Positioning:** Build-time enhanced configuration, used to generate build helpers such as completion scripts at build time (the `comp` feature provides completion script generation). > [!NOTE] > > This feature group is intended for **build dependencies** only and must be used alongside the `advanced` feature. Enable it in the `[build-dependencies]` section of `Cargo.toml`: ```toml [dependencies.mingling] features = ["advanced"] [build-dependencies.mingling] features = ["build_advanced"] ``` ## `build_full` **Enables features:** `build`, `comp`, `pathf`, `dispatch_tree` **Positioning:** Full build-time configuration, extends `build_advanced` with the path analyzer (`pathf`) to automatically resolve type module paths, suitable for projects with complex structures that require automated build-time analysis. > [!NOTE] > > This feature group is intended for **build dependencies** only and must be used alongside the `full` feature. Enable it in the `[build-dependencies]` section of `Cargo.toml`: ```toml [dependencies.mingling] features = ["full"] [build-dependencies.mingling] features = ["build_full"] ``` # Feature Details ## Feature `all_serde_fmt` **Description:** Enables serde formatting support for all serialization formats (JSON, RON, TOML, YAML) in `structural_renderer`. Enabling this feature will automatically enable the four sub-features: `json_serde_fmt`, `ron_serde_fmt`, `toml_serde_fmt`, `yaml_serde_fmt`. ## Feature `async` **Description:** Enables async runtime support, allowing `#[chain]` to bind `async` functions, e.g.: ```rust // Features: ["async"] pack!(StateFoo = ()); #[chain] async fn handle_state_foo(foo: StateFoo) -> Next { StateFoo::new(()).into() } ``` See [example](https://mingling-rs.github.io/mingling/docs/example-viewer.html?name=example-async-support) ## Feature `builds` **Description:** Enables scripts needed for use in `build.rs`, currently including: 1. Completion script generation under the `comp` feature: ```rust // BUILD TIME // Features: ["builds", "comp"] use mingling::build::build_comp_scripts; // Generate completion scripts for `myprogram` build_comp_scripts("myprogram").unwrap(); ``` ## Feature `clap` **Description:** Enables integration with the [clap](https://crates.io/crates/clap) command-line argument parsing library, making it easy to build CLI apps. With this feature enabled, you can use the `#[dispatcher_clap]` attribute macro to generate a dispatcher from a `clap::Parser` struct. See [example](https://mingling-rs.github.io/mingling/docs/example-viewer.html?name=example-clap-binding) ## Feature `comp` **Description:** Enables code completion functionality, providing auto-completion support for interactive environments. When enabled, you can use the `#[completion]` attribute macro to define dynamic completion logic, and generate completion scripts for shells such as bash, zsh, fish, and pwsh. See [example](https://mingling-rs.github.io/mingling/docs/example-viewer.html?name=example-completion) ## Feature `debug` **Description:** Enables debugging-related features, providing more detailed error info and diagnostic output. ## Feature `dispatch_tree` **Description:** Enables the dispatch tree mechanism, supporting conditional dispatch and routing. When enabled, Mingling **at compile time** hard-codes the subcommand structure as a prefix tree (Trie), achieving extremely fast subcommand lookup. Lookup complexity is **O(n)**, where _n_ is the input length, not the number of commands. See [example](https://mingling-rs.github.io/mingling/docs/example-viewer.html?name=example-dispatch-tree) ## Feature `extras` **Description:** Enables an additional set of macros, providing more convenient syntactic sugar and metaprogramming capabilities. For example, allows the shorthand form `dispatcher!("greet")`, which auto-generates `CMDGreet` / `EntryGreet`. | Macro | Description | | ------------------------------------------------------- | --------------------------------------------------------------- | | `empty_result!()` | Shorthand for returning an empty result early in a chain | | `entry!(Type, ["a", "b"])` | Construct test data for an entry type | | `group!(Type)` | Register external types as group members without modifying them | | `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | Create error types with an automatic `name` field | | `#[program_setup]` | Declare a program initialization function | | `dispatcher!("cmd.path")` **shorthand** | Omit `CMDStruct => EntryStruct`, names are auto-derived |Written by @Weicao-CatilGrass