#![allow(dead_code, deprecated, unused_variables, unused_mut)] use std::fmt; struct Length(i32); impl fmt::LowerHex for Length { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let val = self.0; fmt::LowerHex::fmt(&val, f) } } fn main() { let l = Length(9); assert_eq!(format!("l as hex is: {l:x}"), "l as hex is: 9"); assert_eq!(format!("l as hex is: {l:#010x}"), "l as hex is: 0x00000009"); }