Closed wyatt-herkamp closed 2 years ago
I'm not following. Could you try and elaborate on what the issue is?
I'm not following. Could you try and elaborate on what the issue is?
Variables don't seem to be replacing themselves inside quote when on a comment
Gotcha, so interpolation does indeed not work inside of rust-style comments because they are passed into the macros as literal strings (as you can see in how they are expanded).
The way you have to work around this is by formatting the comment yourself:
quote! {
#(format!("/// This switch variant requires a value {requirement} in the compare_to field"))
#<line>
#name #switch_variant_type,
}
I've also opened #26 which will allow you to use format_args!
directly once merged, all though it would fundamentally accomplish the same thing.
#(format!("/// This switch variant requires a value {requirement} in the compare_to field"))
Cool it works!. Thank you
So this is my code
It generates
Requirement is equal to "12"