Format Strings
Format strings are strings which include a special notation to insert expressions into a text.
std::debug::assert_eq(["{2 + 5}", "7"]);
Usually they are used to insert parameters into text:
fn print_length(length: Length) {
std::print("{length}");
}
print_length(7mm);
Bad Expression in Format String
If a format string expression cannot be evaluated, you will get an error.
fn print_length(length: Length) {
std::print("{size}"); // error: size is not known
}
print_length(7mm);