Function macro_tools::orphan::debug_report_print
source · pub fn debug_report_print<IntoAbout, IntoTokens>(
about: IntoAbout,
input: IntoTokens,
output: &TokenStream
)
Expand description
Prints a debugging report for a pair of token streams to the standard output.
This convenience function wraps debug_report_format
, directly printing the formatted report to stdout.
It serves as a utility for debugging procedural macros, providing a clear comparison between original
and generated code.
§Parameters and Type Parameters
- Same as
debug_report_format
.
§Examples
use macro_tools::exposed::*;
let original_input : proc_macro2::TokenStream = qt!
{
#[ derive( Debug, PartialEq ) ]
pub struct MyStruct
{
pub field : i32,
}
};
let generated_code : proc_macro2::TokenStream = qt!
{
impl MyStruct
{
pub fn new( field : i32 ) -> Self
{
MyStruct { field }
}
}
};
// Directly print the debug report
debug_report_print( "derive :: MyDerive", original_input, &generated_code );
This will output a formatted report showing the original input code and the generated code side by side, each line indented for clarity.