std-module

std::fmt module

Formatting separates a value from the textual representation requested by its consumer. The format specification selects a trait; the destination receives text. Expected stdout (not executed): 42 2a Common mistake: Expecting formatting to change the original number.

Formal Syntax & Structure

rust syntaxrust
use std::fmt;

Working Example

Example Snippetrust
fn main() {    let value = 42;    println!("{} {:x}", value, value);}
Rust Reference