The format! macro works in a way similar to string formatters in other languages:
fn main() { let home_team = "Liverpool"; let result = " beat "; let away_team = "Manchester United"; let full_line = format!("{}{}{}", home_team, result, away_team); println!("{}", full_line); }
The {} in the format strings mark spots for the following parameters. The spots are filled in order, so full_line will be a concatenation of home_team, result, and away_team.
When the preceding code snippet is compiled and executed, you will see the following: