Format raw strings in rust

When refactoring code to make API call to Gemini, I learnt how to format raw strings in rust.

fn main() {
    let var1 = "test1";
    let formatted = format!(r#"var1 is: {}"#, var1);
    println!("{}", formatted);
}

This gives output as : var1 is: test1

If you want { in the output, then it needs to be escaped with additional { like:

fn main() {
    let var1 = "test1";
    let formatted = format!(r#"{{contents: {}}}"#, var1);
    println!("{}", formatted);
}

This gives output as : {contents: test1}