use std::fmt; struct X { i: i32, } impl fmt::Display for X { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Hello: {}", self.i) } } fn main() { let x = X { i: 111, }; println!("{}", x); }