When developing complex macros, most of the time you need ways to analyze how your code expands to the inputs you gave to the macro. You can always use println! or panic! at the places you want to see the generated code, but it's a very crude way to debug it. There's are better way, though. The Rust community provides us with a subcommand called cargo-expand. This subcommand was developed by David Tonlay at https://github.com/dtolnay/cargo-expand, who is also the author of the syn and quote crates. This command internally calls the nightly compiler flag -Zunstable-options --pretty=expanded, but the design of the subcommand was done in such a way that it doesn't require you to manually switch to the nightly tool chain as it finds and switches to it automatically. To demonstrate this command, we'll take the example of our IntoMap derive macro...
 United States
            United States
             Great Britain
            Great Britain
             India
            India
             Germany
            Germany
             France
            France
             Canada
            Canada
             Russia
            Russia
             Spain
            Spain
             Brazil
            Brazil
             Australia
            Australia
             Singapore
            Singapore
             Canary Islands
            Canary Islands
             Hungary
            Hungary
             Ukraine
            Ukraine
             Luxembourg
            Luxembourg
             Estonia
            Estonia
             Lithuania
            Lithuania
             South Korea
            South Korea
             Turkey
            Turkey
             Switzerland
            Switzerland
             Colombia
            Colombia
             Taiwan
            Taiwan
             Chile
            Chile
             Norway
            Norway
             Ecuador
            Ecuador
             Indonesia
            Indonesia
             New Zealand
            New Zealand
             Cyprus
            Cyprus
             Denmark
            Denmark
             Finland
            Finland
             Poland
            Poland
             Malta
            Malta
             Czechia
            Czechia
             Austria
            Austria
             Sweden
            Sweden
             Italy
            Italy
             Egypt
            Egypt
             Belgium
            Belgium
             Portugal
            Portugal
             Slovenia
            Slovenia
             Ireland
            Ireland
             Romania
            Romania
             Greece
            Greece
             Argentina
            Argentina
             Netherlands
            Netherlands
             Bulgaria
            Bulgaria
             Latvia
            Latvia
             South Africa
            South Africa
             Malaysia
            Malaysia
             Japan
            Japan
             Slovakia
            Slovakia
             Philippines
            Philippines
             Mexico
            Mexico
             Thailand
            Thailand
             
     
         
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                