std::fmt
Module std::fmt
Utilities for formatting and printing String
s
This module contains the runtime support for the format!
syntax extension. This macro is implemented in the compiler to emit calls to this module in order to format arguments at runtime into strings.
Usage
The format!
macro is intended to be familiar to those coming from C's printf/fprintf functions or Python's str.format
function.
Some examples of the format!
extension are:
format!("Hello"); // => "Hello" format!("Hello, {}!", "world"); // => "Hello, world!" format!("The number is {}", 1); // => "The number is 1" format!("{:?}", (3, 4)); // => "(3, 4)" format!("{value}", value=4); // => "4" format!("{} {}", 1, 2); // => "1 2" format!("{:04}", 42);