As I understand it, depending on the format string, the corresponding trait (e.g.: {:?} calls Debug)
will be called. Is it possible to imagine a proposal where for example:
println!("{?myformat}", myStruct}
will call a specific trait by also passing the format string ?
If Html is a typical temporary wrapper, I'd construct it so that you use Html(&s) to format something with it. (I.e a reference to your type). Then it's easy to use temporarily and you don't need to care about ownership or moving it out again.
(This is only relevant for the impl Display for Html<S> part, which you'd change a bit to implement it for Html<&'a S> for all 'a instead).
@dandyvica One advantage to implementing Display is that it's easily recursively composable, without having to allocate any temporary strings for each piece. Its overhead is the format-related overhead (virtual function calls) and that's it.