Expand description
Mingling Macros Crate
This crate provides procedural macros for the Mingling framework. Macros are implemented in separate modules and re-exported here.
§Architecture Overview
The Mingling macros crate provides the following categories of macros:
- Command definition:
dispatcher!,dispatcher_clap!,node!,pack! - Chain processing:
#[chain],gen_program!,route!,empty_result! - Rendering:
#[renderer],r_print!,r_println! - Help system:
#[help],register_help! - Derive macros:
#[derive(Groupped)],#[derive(EnumTag)],#[derive(GrouppedSerialize)] - Program setup:
#[program_setup] - Completion (comp feature):
#[completion],suggest!,suggest_enum! - Internal registration:
register_type!,register_chain!,register_renderer!,program_fallback_gen!,program_final_gen!,program_comp_gen!
Macros§
- dispatcher
- Creates a
Dispatcherimplementation for a subcommand. - gen_
program - Generates the program enum and all collected types, chains, and renderers.
- node
- Creates a
Nodefrom a dot-separated path string. - pack
- Creates a type-safe wrapper struct around an inner type, with automatic trait implementations for use in the Mingling chain/render pipeline.
- program_
fallback_ gen - Internal macro used by
gen_program!to generate fallback types. - program_
final_ gen - Internal macro used by
gen_program!to generate the final program enum and itsProgramCollectimplementation. - r_print
- Prints formatted text to the current
RenderResultbuffer within a#[renderer](macro.renderer.html) function. - r_
println - Prints formatted text followed by a newline to the current
RenderResultbuffer within a#[renderer](macro.renderer.html) function. - register_
chain - Registers a chain mapping from a previous type to a chain struct.
- register_
dispatcher - Registers a dispatcher at compile time for the
dispatch_treefeature. - register_
help - Registers a help request mapping between an entry type and a help struct.
- register_
renderer - Registers a renderer mapping from a type to a renderer struct.
- register_
type - Registers a type into the global packed types registry for inclusion in
the program enum generated by
gen_program!.
Attribute Macros§
- chain
- Declares a chain processing step that transforms one type into another within a Mingling pipeline.
- help
- Declares a help rendering function for an entry type.
- renderer
- Declares a renderer step that renders the output of a chain to the terminal.