component

Macro component 

Source
component!() { /* proc-macro */ }
Expand description

Define component enums with automatic ComponentId trait implementation.

Supports all 6 metadata fields in any order:

  • value - Custom string (default: identifier as-is)
  • description - Documentation string
  • introduced - Version introduced
  • deprecated - Deprecation notice
  • examples - Array of example error codes
  • tags - Array of category tags

§Examples

component! {
    Auth,                    // Simple: "Auth"
    Parser {                 // With metadata
        value: "PARSER",
        description: "Parsing subsystem",
        introduced: "1.0.0",
        tags: ["frontend", "compile-time"],
    },
}

// Generated code implements ComponentIdDocumented trait:
let desc = Component::Parser.description();  // Trait method
let tags = Component::Parser.tags();