Hello,
Is it possible to have print macros like the following code:
fn main() {
print!("{}" "{}", Varibale, Variable);
print!("{}" , "{}", Varibale, Variable);
}
Thank you.
Hello,
Is it possible to have print macros like the following code:
fn main() {
print!("{}" "{}", Varibale, Variable);
print!("{}" , "{}", Varibale, Variable);
}
Thank you.
print!()
doesn't allow more than one format string. Why do you think you need this?
The print!()
family of macros can evaluate other macros that appear in the format string position, so you can use things like stringify!
and concat!
to build it up from pieces if you need to. For example,
fn main() {
let a = 5;
let b = 7;
// Same as `println!("{a} {b}", a=a, b=b)`
println!(
concat!(
"{", stringify!(a), "}",
' ',
"{", stringify!(b), "}",
),
a=a,
b=b,
);
}
Hello,
Thank you so much for your reply.
I just wanted to know.