Skip to main content

Crate mingling_macros

Crate mingling_macros 

Source
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 Dispatcher implementation for a subcommand.
gen_program
Generates the program enum and all collected types, chains, and renderers.
node
Creates a Node from 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 its ProgramCollect implementation.
r_print
Prints formatted text to the current RenderResult buffer within a #[renderer](macro.renderer.html) function.
r_println
Prints formatted text followed by a newline to the current RenderResult buffer 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_tree feature.
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.

Derive Macros§

EnumTag
Derive macro for automatically implementing the EnumTag trait on an enum with unit-only variants.
Groupped
Derive macro for automatically implementing the Groupped trait on a struct.