SPRINGIFY! di karat
// You can use it in a macro
macro_rules! foo {
($a:ident) => {
println!("{}", stringify!($a))
}
}
fn main() {
foo!(hello); // prints `hello`
// Also you can use it to convert an expression to a &str:
let one_plus_one = stringify!(1 + 1);
assert_eq!(one_plus_one, "1 + 1");
}
Ahmad Khaefi