Creating a Custom Colored dbg! Macro In Rust
问题 I'd like to create a custom macro similar to the standard dbg! macro, but with the option to use colors via the colored crate. dbg! usually prints something with the format of [path_to_file:line_number] "symbol name" = "symbol value" //[src/gallery/image_slot.rs:231] "my_integer_value_of_12" = "12" How do I access the path/line number [path_to_file:line_number] so I can print it? How do I access the symbol name of a variable? (i.e. print my_var given my_var = 12 ) 回答1: Use the file!, line!,