use std::fmt; struct Swagger(pub T); impl fmt::Display for Swagger { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { write!(f, "yolo {} swag", self.0) } } trait SwaggerExt: Sized { fn with_swag(self) -> Swagger; } impl SwaggerExt for T { fn with_swag(self) -> Swagger { Swagger(self) } } fn main() { let pi = 3.14; println!("{}", pi); println!("{}", Swagger(pi)); println!("{}", pi.with_swag()); }