let n: u64 = 1;
println!("{}", quote!(#n));
The output is 1u64
. How to output 1
directly?
let n: u64 = 1;
println!("{}", quote!(#n));
The output is 1u64
. How to output 1
directly?
You can use proc_macro2::Literal
, specifically Literal::u64_unsuffixed(1)
.
How to convert Literal
to TokenStream
?
Solved.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.