trait

LowerHex formatting

Select the LowerHex trait using the matching format specifier. This creates text without changing the numeric value. Expected stdout (not executed): fa Common mistake: Expecting the displayed text to change the stored value.

Formal Syntax & Structure

rust syntaxrust
{:x}

Working Example

Example Snippetrust
fn main() {    let n = 250u8;    println!("{:x}", n);}
Rust Reference